[s3]testparm: give testparm one common exit point and call gfree_loadparm().
authorMichael Adam <obnox@samba.org>
Sat, 27 Sep 2008 20:10:44 +0000 (22:10 +0200)
committerMichael Adam <obnox@samba.org>
Sat, 27 Sep 2008 20:28:25 +0000 (22:28 +0200)
Michael

source3/utils/testparm.c

index ccbb2dd3918e4d2e3e3b8f90c894ad8417245cc6..4370d49523a7cf59d721c9450fa880ab2a7f4d30 100644 (file)
@@ -333,7 +333,8 @@ rameter is ignored when using CUPS libraries.\n",
 
        if ( cname && ! caddr ) {
                printf ( "ERROR: You must specify both a machine name and an IP address.\n" );
-               return(1);
+               ret = 1;
+               goto done;
        }
 
        if (new_local_machine) {
@@ -348,7 +349,8 @@ rameter is ignored when using CUPS libraries.\n",
 
        if (!lp_load_with_registry_shares(config_file,False,True,False,True)) {
                fprintf(stderr,"Error loading services.\n");
-               return(1);
+               ret = 1;
+               goto done;
        }
 
        fprintf(stderr,"Loaded services file OK.\n");
@@ -395,13 +397,15 @@ rameter is ignored when using CUPS libraries.\n",
                                 (s=lp_servicenumber(section_name)) == -1) {
                                        fprintf(stderr,"Unknown section %s\n",
                                                section_name);
-                                       return(1);
+                                       ret = 1;
+                                       goto done;
                        }
                        if (parameter_name) {
                                if (!dump_a_parameter( s, parameter_name, stdout, isGlobal)) {
                                        fprintf(stderr,"Parameter %s unknown for section %s\n",
                                                parameter_name, section_name);
-                                       return(1);
+                                       ret = 1;
+                                       goto done;
                                }
                        } else {
                                if (isGlobal == True)
@@ -409,7 +413,7 @@ rameter is ignored when using CUPS libraries.\n",
                                else
                                        lp_dump_one(stdout, show_defaults, s);
                        }
-                       return(ret);
+                       goto done;
                }
 
                lp_dump(stdout, show_defaults, lp_numservices());
@@ -430,7 +434,10 @@ rameter is ignored when using CUPS libraries.\n",
                        }
                }
        }
+
+done:
        TALLOC_FREE(frame);
-       return(ret);
+       gfree_loadparm();
+       return ret;
 }