]> git.sesse.net Git - x264/commitdiff
param_parse: Fix memory leak
authorHenrik Gramner <henrik@gramner.com>
Tue, 23 Jun 2015 13:38:16 +0000 (15:38 +0200)
committerAnton Mitrofanov <BugMaster@narod.ru>
Thu, 16 Jul 2015 21:41:27 +0000 (00:41 +0300)
common/common.c

index de5d441b90793c47031cb6833b35e192aff0e39c..b32c5d331f5d96d10d09b1614bd1f0bc2fecc108 100644 (file)
@@ -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;
 }
 
 /****************************************************************************