Free memory when recovering from errors.

This commit is contained in:
rocky
2008-08-30 06:55:50 +00:00
parent 5254ca152d
commit 3d106b4568

View File

@@ -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 <rocky@gnu.org>
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 <cdio/logging.h>
#include <cdio/sector.h>
@@ -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))