Fixed a SIGSEGV with empty drive

This commit is contained in:
2007-10-18 22:56:43 +00:00
parent 6a7329cd11
commit 38adcb045b
4 changed files with 15 additions and 7 deletions

View File

@ -71,7 +71,8 @@ uint32_t iso_read_lsb(const uint8_t *buf, int bytes)
/* API function. See libisoburn.h
*/
int isoburn_read_volset(struct burn_drive *d, struct isoburn_read_opts *read_opts,
int isoburn_read_volset(struct burn_drive *d,
struct isoburn_read_opts *read_opts,
struct iso_volset **volset)
{
int ret;
@ -79,7 +80,12 @@ int isoburn_read_volset(struct burn_drive *d, struct isoburn_read_opts *read_opt
enum burn_disc_status status;
struct isoburn *o;
assert(d && read_opts && volset);
if(d==NULL || read_opts==NULL || volset==NULL) {
/* >>> program error */;
return(-1);
}
ret = isoburn_find_emulator(&o, d, 0);
if (ret < 0)
@ -111,6 +117,7 @@ int isoburn_read_volset(struct burn_drive *d, struct isoburn_read_opts *read_opt
return -1;
o->target_volset = *volset;
iso_volset_ref(o->target_volset); /* protects object from premature free */
return 1;
}