diff --git a/lib/driver/osx.c b/lib/driver/osx.c index 415e39f0..5c9a63d7 100644 --- a/lib/driver/osx.c +++ b/lib/driver/osx.c @@ -1,5 +1,5 @@ /* - $Id: osx.c,v 1.12 2008/04/22 15:29:12 karl Exp $ + $Id: osx.c,v 1.13 2008/08/30 06:55:50 rocky Exp $ Copyright (C) 2003, 2004, 2005, 2006, 2008 Rocky Bernstein from vcdimager code: @@ -33,7 +33,7 @@ #include "config.h" #endif -static const char _rcsid[] = "$Id: osx.c,v 1.12 2008/04/22 15:29:12 karl Exp $"; +static const char _rcsid[] = "$Id: osx.c,v 1.13 2008/08/30 06:55:50 rocky Exp $"; #include #include @@ -1933,7 +1933,10 @@ cdio_open_osx (const char *psz_orig_source) if (NULL == psz_orig_source) { psz_source=cdio_get_default_device_osx(); - if (NULL == psz_source) return NULL; + if (NULL == psz_source) { + cdio_generic_free(_data); + return NULL; + } _set_arg_osx(_data, "source", psz_source); free(psz_source); } else { @@ -1944,13 +1947,16 @@ cdio_open_osx (const char *psz_orig_source) #if 0 cdio_info ("source %s is a not a device", psz_orig_source); #endif + cdio_generic_free(_data); return NULL; } } ret = cdio_new ((void *)_data, &_funcs); - if (ret == NULL) return NULL; - + if (ret == NULL) { + cdio_generic_free(_data); + return NULL; + } ret->driver_id = DRIVER_OSX; if (cdio_generic_init(_data, O_RDONLY) && init_osx(_data))