]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix bug #1431 about bad reload command.
authorEric Bollengier <eric@eb.homelinux.org>
Mon, 7 Dec 2009 16:11:08 +0000 (17:11 +0100)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 8 Dec 2009 08:00:49 +0000 (09:00 +0100)
Still an object to free in this case.

bacula/src/lib/parse_conf.c

index b39eedf6bf0b12ebd284ac6dbea72d5c2a83ca3c..3313e680f39ca9ae95bf54f1505cd7ff6eac0710 100644 (file)
@@ -913,10 +913,10 @@ bool CONFIG::parse_config()
             } else if (token == T_UTF16_BOM) {
                scan_err0(lc, _("Currently we cannot handle UTF-16 source files. "
                    "Please convert the conf file to UTF-8\n"));
-               return 0;
+               goto bail_out;
             } else if (token != T_IDENTIFIER) {
                scan_err1(lc, _("Expected a Resource name identifier, got: %s"), lc->str);
-               return 0;
+               goto bail_out;
             }
             for (i=0; resources[i].name; i++) {
                if (strcasecmp(resources[i].name, lc->str) == 0) {
@@ -932,7 +932,7 @@ bool CONFIG::parse_config()
             }
             if (state == p_none) {
                scan_err1(lc, _("expected resource name, got: %s"), lc->str);
-               return 0;
+               goto bail_out;
             }
             break;
          case p_resource:
@@ -943,7 +943,7 @@ bool CONFIG::parse_config()
             case T_IDENTIFIER:
                if (level != 1) {
                   scan_err1(lc, _("not in resource definition: %s"), lc->str);
-                  return 0;
+                  goto bail_out;
                }
                for (i=0; items[i].name; i++) {
                   if (strcasecmp(items[i].name, lc->str) == 0) {
@@ -954,7 +954,7 @@ bool CONFIG::parse_config()
                         Dmsg1 (900, "in T_IDENT got token=%s\n", lex_tok_to_str(token));
                         if (token != T_EQUALS) {
                            scan_err1(lc, _("expected an equals, got: %s"), lc->str);
-                           return 0;
+                           goto bail_out;
                         }
                      }
                      Dmsg1(800, "calling handler for %s\n", items[i].name);
@@ -969,7 +969,7 @@ bool CONFIG::parse_config()
                   Dmsg1(900, "Keyword = %s\n", lc->str);
                   scan_err1(lc, _("Keyword \"%s\" not permitted in this resource.\n"
                      "Perhaps you left the trailing brace off of the previous resource."), lc->str);
-                  return 0;
+                  goto bail_out;
                }
                break;
 
@@ -979,7 +979,7 @@ bool CONFIG::parse_config()
                Dmsg0(900, "T_EOB => define new resource\n");
                if (res_all.hdr.name == NULL) {
                   scan_err0(lc, _("Name not specified for resource"));
-                  return 0;
+                  goto bail_out;
                }
                save_resource(res_type, items, pass);  /* save resource */
                break;
@@ -990,17 +990,17 @@ bool CONFIG::parse_config()
             default:
                scan_err2(lc, _("unexpected token %d %s in resource definition"),
                   token, lex_tok_to_str(token));
-               return 0;
+               goto bail_out;
             }
             break;
          default:
             scan_err1(lc, _("Unknown parser state %d\n"), state);
-            return 0;
+            goto bail_out;
          }
       }
       if (state != p_none) {
          scan_err0(lc, _("End of conf file reached with unclosed resource."));
-         return 0;
+         goto bail_out;
       }
       if (debug_level >= 900 && pass == 2) {
          int i;
@@ -1012,6 +1012,11 @@ bool CONFIG::parse_config()
    }
    Dmsg0(900, "Leave parse_config()\n");
    return 1;
+bail_out:
+   if (lc) {
+      lc = lex_close_file(lc);
+   }
+   return 0;
 }
 
 const char *get_default_configdir()