Commit 19c41c6d authored by Clément Bœsch's avatar Clément Bœsch Committed by Clément Bœsch

opt: re-enable memleak fix for duplicated options.

The memleak fix in a1bcc76e was causing problems when the original
string wasn't NULL or av_malloc'ed, thus was disabled. It seems the only
OPT_STRING occurence where it needed to be fixed is in ffserver. This
commit fixes that specific problem and so re-enable the original code.
parent 12fe78a7
...@@ -278,7 +278,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt, ...@@ -278,7 +278,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
if (po->flags & OPT_STRING) { if (po->flags & OPT_STRING) {
char *str; char *str;
str = av_strdup(arg); str = av_strdup(arg);
// av_freep(dst); av_freep(dst);
*(char **)dst = str; *(char **)dst = str;
} else if (po->flags & OPT_BOOL || po->flags & OPT_INT) { } else if (po->flags & OPT_BOOL || po->flags & OPT_INT) {
*(int *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); *(int *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
......
...@@ -308,7 +308,7 @@ static int rtp_new_av_stream(HTTPContext *c, ...@@ -308,7 +308,7 @@ static int rtp_new_av_stream(HTTPContext *c,
static const char *my_program_name; static const char *my_program_name;
static const char *config_filename = "/etc/ffserver.conf"; static const char *config_filename;
static int ffserver_debug; static int ffserver_debug;
static int no_launch; static int no_launch;
...@@ -4716,6 +4716,9 @@ int main(int argc, char **argv) ...@@ -4716,6 +4716,9 @@ int main(int argc, char **argv)
parse_options(NULL, argc, argv, options, NULL); parse_options(NULL, argc, argv, options, NULL);
if (!config_filename)
config_filename = av_strdup("/etc/ffserver.conf");
unsetenv("http_proxy"); /* Kill the http_proxy */ unsetenv("http_proxy"); /* Kill the http_proxy */
av_lfg_init(&random_state, av_get_random_seed()); av_lfg_init(&random_state, av_get_random_seed());
...@@ -4728,6 +4731,7 @@ int main(int argc, char **argv) ...@@ -4728,6 +4731,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Incorrect config file - exiting.\n"); fprintf(stderr, "Incorrect config file - exiting.\n");
exit(1); exit(1);
} }
av_freep(&config_filename);
/* open log file if needed */ /* open log file if needed */
if (logfilename[0] != '\0') { if (logfilename[0] != '\0') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment