summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorvan <[email protected]>2008-10-04 19:21:49 +0000
committervan <[email protected]>2008-10-04 19:21:49 +0000
commitd170c27830120929739ab9a382d65fa479ab9053 (patch)
tree64e171a5a9472cab0cff1d4de318ef0d1f441ce0 /libhb
parent26acbfb43a17573bd88e36a4f99e6b5ab8551e73 (diff)
Sanity check in encfaacClose or we'll abort on an illegal channel spec or sample ratesince init sets job->die which causes close to be called when the work struct hasn't been fully set up.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1812 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/encfaac.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/libhb/encfaac.c b/libhb/encfaac.c
index ae2e54b36..cd333d3f3 100644
--- a/libhb/encfaac.c
+++ b/libhb/encfaac.c
@@ -127,12 +127,29 @@ int encfaacInit( hb_work_object_t * w, hb_job_t * job )
void encfaacClose( hb_work_object_t * w )
{
hb_work_private_t * pv = w->private_data;
- faacEncClose( pv->faac );
- free( pv->buf );
- free( pv->obuf );
- hb_list_empty( &pv->list );
- free( pv );
- w->private_data = NULL;
+ if ( pv )
+ {
+ if ( pv->faac )
+ {
+ faacEncClose( pv->faac );
+ pv->faac = NULL;
+ }
+ if ( pv->buf )
+ {
+ free( pv->buf );
+ pv->buf = NULL;
+ }
+ if ( pv->obuf )
+ {
+ free( pv->obuf );
+ pv->obuf = NULL;
+ }
+ if ( pv->list )
+ hb_list_empty( &pv->list );
+
+ free( pv );
+ w->private_data = NULL;
+ }
}
/***********************************************************************