[Highly Complete Input] Fix possible crash on OOM
If one condition returned memory successfully, but the other did not, it would result in the cleanup code accessing an uninitialized pointer and iterating over it, crashing. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
b03fdeaf7a
commit
f02a36fd08
1 changed files with 1 additions and 1 deletions
|
@ -305,11 +305,11 @@ static int addarchive(
|
|||
// create a source entry for this psf2
|
||||
this_source = ( struct SOURCE_FILE * ) malloc( sizeof( struct SOURCE_FILE ) );
|
||||
if(!this_source) goto outofmemory;
|
||||
this_source->next = NULL;
|
||||
this_source->reserved_data = ( uint8_t * ) malloc( reserved_size );
|
||||
if(!this_source->reserved_data) goto outofmemory;
|
||||
memcpy(this_source->reserved_data, reserved_data, reserved_size);
|
||||
this_source->reserved_size = reserved_size;
|
||||
this_source->next = NULL;
|
||||
this_dir = makearchivedir(fs, 0, this_source);
|
||||
if(fs->adderror) goto error;
|
||||
|
||||
|
|
Loading…
Reference in a new issue