Skip to content

Commit

Permalink
Merge pull request #367 from scottaiton/fix_memleak_in_options
Browse files Browse the repository at this point in the history
Fix memory leak in fclaw_options_register
  • Loading branch information
scottaiton authored Nov 13, 2024
2 parents 1e6eba4 + 9c1b240 commit fea33fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/fclaw_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ fclaw_options_t* fclaw_options_register (fclaw_app_t * a,
fclaw_opt_sections = sc_keyvalue_new();
fclaw_app_set_attribute(a, "fclaw_opt_sections", fclaw_opt_sections);
}
char *key = strdup(section == NULL ? "Options" : section);
char *key = FCLAW_STRDUP(section == NULL ? "Options" : section);
char* curr_char = key;
while(*curr_char != '\0')
{
Expand All @@ -602,6 +602,7 @@ fclaw_options_t* fclaw_options_register (fclaw_app_t * a,
sc_keyvalue_set_int(fclaw_opt_sections,
key,
1);
FCLAW_FREE(key);

return fclaw_opt;
}
Expand Down

0 comments on commit fea33fc

Please sign in to comment.