mirror of
https://github.com/ipxe/ipxe
synced 2025-12-21 20:40:25 +03:00
[image] Avoid potential NULL pointer dereference
Detected using Valgrind. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -96,9 +96,11 @@ struct image * alloc_image ( struct uri *uri ) {
|
|||||||
ref_init ( &image->refcnt, free_image );
|
ref_init ( &image->refcnt, free_image );
|
||||||
if ( uri ) {
|
if ( uri ) {
|
||||||
image->uri = uri_get ( uri );
|
image->uri = uri_get ( uri );
|
||||||
name = basename ( ( char * ) uri->path );
|
if ( uri->path ) {
|
||||||
if ( ( rc = image_set_name ( image, name ) ) != 0 )
|
name = basename ( ( char * ) uri->path );
|
||||||
goto err_set_name;
|
if ( ( rc = image_set_name ( image, name ) ) != 0 )
|
||||||
|
goto err_set_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|||||||
Reference in New Issue
Block a user