Fixed a SIGSEGV with empty drive
This commit is contained in:
parent
ccb12bf119
commit
b12a8fd219
@ -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;
|
||||
}
|
||||
|
||||
|
@ -3409,7 +3409,7 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
|
||||
ret= Xorriso_give_up_drive(xorriso, flag&3);
|
||||
else
|
||||
ret= Xorriso_aquire_drive(xorriso, adr, flag&3);
|
||||
if(ret<=0)
|
||||
if(ret<0)
|
||||
return(ret);
|
||||
if(Sfile_str(xorriso->indev, adr, 0)<=0)
|
||||
return(-1);
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2007.10.18.221756"
|
||||
#define Xorriso_timestamP "2007.10.18.225654"
|
||||
|
@ -184,9 +184,9 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
||||
xorriso->in_volset_handle= volset;
|
||||
ret= 1;
|
||||
ex:
|
||||
if(ret<=0) {
|
||||
if(ret<0) {
|
||||
|
||||
/* >>> ??? give up not-so-suitable drive ? */;
|
||||
/* >>> give up drive */;
|
||||
|
||||
}
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
@ -210,7 +210,8 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
||||
"on attempt to give drive up", 0);
|
||||
isoburn_drive_release(drive,0);
|
||||
|
||||
iso_volset_free((struct iso_volset *) xorriso->in_volset_handle);
|
||||
if(xorriso->in_volset_handle!=NULL)
|
||||
iso_volset_free((struct iso_volset *) xorriso->in_volset_handle);
|
||||
xorriso->in_volset_handle= NULL;
|
||||
xorriso->volset_change_pending= 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user