diff options
author | eddyg <[email protected]> | 2007-10-02 03:30:45 +0000 |
---|---|---|
committer | eddyg <[email protected]> | 2007-10-02 03:30:45 +0000 |
commit | 7b750d30e23312c7c9924be13b81c0b8c9296c99 (patch) | |
tree | 7a12c2bd28f5fcda0f08107978cbba7bf7ad9a82 | |
parent | c2d42d36deaa4dc98c113c8c5dc688979c583728 (diff) |
When duplicating the x264 options keep a pointer to the start of the options so that we can free them. Also check that the memory allocation actually succeeded.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@998 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/encx264.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c index 0de2e9f3b..7c2d55480 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -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); } |