Commit 94e476d8 authored by Henrik Gramner's avatar Henrik Gramner Committed by Anton Mitrofanov
Browse files

param_parse: Fix memory leak

parent 45856b97
...@@ -579,6 +579,7 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value ) ...@@ -579,6 +579,7 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
{ {
char *name_buf = NULL; char *name_buf = NULL;
int b_error = 0; int b_error = 0;
int errortype = X264_PARAM_BAD_VALUE;
int name_was_bool; int name_was_bool;
int value_was_null = !value; int value_was_null = !value;
int i; int i;
...@@ -1049,7 +1050,10 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value ) ...@@ -1049,7 +1050,10 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
OPT("opencl-device") OPT("opencl-device")
p->i_opencl_device = atoi( value ); p->i_opencl_device = atoi( value );
else else
return X264_PARAM_BAD_NAME; {
b_error = 1;
errortype = X264_PARAM_BAD_NAME;
}
#undef OPT #undef OPT
#undef OPT2 #undef OPT2
#undef atobool #undef atobool
...@@ -1060,7 +1064,7 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value ) ...@@ -1060,7 +1064,7 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
free( name_buf ); free( name_buf );
b_error |= value_was_null && !name_was_bool; b_error |= value_was_null && !name_was_bool;
return b_error ? X264_PARAM_BAD_VALUE : 0; return b_error ? errortype : 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