s3-loadparm: fixed a memory leak in parametric options
authorAndrew Tridgell <tridge@samba.org>
Tue, 26 Jul 2011 02:19:58 +0000 (12:19 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 8 Sep 2011 13:09:54 +0000 (15:09 +0200)
before we memset the Globals structure we need to free any global
parametrics

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source3/param/loadparm.c

index 305ff2cec9547a12d12ca7dab5ceef5c96177681..21fa662141bd69addc6f2ab8cbdba7081290c69c 100644 (file)
@@ -310,6 +310,7 @@ static void set_allowed_client_auth(void);
 
 static void add_to_file_list(const char *fname, const char *subfname);
 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
+static void free_param_opts(struct parmlist_entry **popts);
 
 static const struct enum_list enum_protocol[] = {
        {PROTOCOL_SMB2_02, "SMB2"}, /* for now keep PROTOCOL_SMB2_02 */
@@ -4605,6 +4606,7 @@ static void free_parameters_by_snum(int snum)
  */
 static void free_global_parameters(void)
 {
+       free_param_opts(&Globals.param_opt);
        free_parameters_by_snum(GLOBAL_SECTION_SNUM);
 }
 
@@ -5420,7 +5422,6 @@ static bool do_section(const char *pszSectionName, void *userdata);
 static void init_copymap(struct loadparm_service *pservice);
 static bool hash_a_service(const char *name, int number);
 static void free_service_byindex(int iService);
-static void free_param_opts(struct parmlist_entry **popts);
 static void show_parameter(int parmIndex);
 static bool is_synonym_of(int parm1, int parm2, bool *inverse);