From: Henrik Gramner Date: Tue, 23 Jun 2015 13:38:16 +0000 (+0200) Subject: param_parse: Fix memory leak X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94e476d80b9635508907893c97e8f8d9f0bc9ddf;p=libx264 param_parse: Fix memory leak --- diff --git a/common/common.c b/common/common.c index de5d441b..b32c5d33 100644 --- a/common/common.c +++ b/common/common.c @@ -579,6 +579,7 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value ) { char *name_buf = NULL; int b_error = 0; + int errortype = X264_PARAM_BAD_VALUE; int name_was_bool; int value_was_null = !value; int i; @@ -1049,7 +1050,10 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value ) OPT("opencl-device") p->i_opencl_device = atoi( value ); else - return X264_PARAM_BAD_NAME; + { + b_error = 1; + errortype = X264_PARAM_BAD_NAME; + } #undef OPT #undef OPT2 #undef atobool @@ -1060,7 +1064,7 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value ) free( name_buf ); b_error |= value_was_null && !name_was_bool; - return b_error ? X264_PARAM_BAD_VALUE : 0; + return b_error ? errortype : 0; } /****************************************************************************