OSDN Git Service

When duplicating the x264 options keep a pointer to the start of the options so that...
authoreddyg <eddyg@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 2 Oct 2007 03:30:45 +0000 (03:30 +0000)
committereddyg <eddyg@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 2 Oct 2007 03:30:45 +0000 (03:30 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@998 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/encx264.c

index 0de2e9f..7c2d554 100644 (file)
@@ -99,8 +99,11 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
 
     if( job->x264opts != NULL && *job->x264opts != '\0' )
     {
-        char *x264opts = strdup(job->x264opts);
-        while( *x264opts )
+        char *x264opts, *x264opts_start;
+
+        x264opts = x264opts_start = strdup(job->x264opts);
+
+        while( x264opts_start && *x264opts )
         {
             char *name = x264opts;
             char *value;
@@ -161,7 +164,7 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
             if( ret == X264_PARAM_BAD_VALUE )
                 hb_log( "x264 options: Bad argument %s=%s", name, value ? value : "(null)" );
         }
-        free(x264opts);
+        free(x264opts_start);
     }