[x264-devel] param_parse: Fix memory leak

Henrik Gramner git at videolan.org
Sun Jul 26 22:26:29 CEST 2015


x264 | branch: master | Henrik Gramner <henrik at gramner.com> | Tue Jun 23 15:38:16 2015 +0200| [94e476d80b9635508907893c97e8f8d9f0bc9ddf] | committer: Anton Mitrofanov

param_parse: Fix memory leak

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=94e476d80b9635508907893c97e8f8d9f0bc9ddf
---

 common/common.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/common.c b/common/common.c
index de5d441..b32c5d3 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;
 }
 
 /****************************************************************************



More information about the x264-devel mailing list