[image] Avoid potential NULL pointer dereference

Detected using Valgrind.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/6/head
Michael Brown 2012-05-08 21:04:57 +01:00
parent 3e6e0078e0
commit c124f21f56
1 changed files with 5 additions and 3 deletions

View File

@ -96,9 +96,11 @@ struct image * alloc_image ( struct uri *uri ) {
ref_init ( &image->refcnt, free_image );
if ( uri ) {
image->uri = uri_get ( uri );
name = basename ( ( char * ) uri->path );
if ( ( rc = image_set_name ( image, name ) ) != 0 )
goto err_set_name;
if ( uri->path ) {
name = basename ( ( char * ) uri->path );
if ( ( rc = image_set_name ( image, name ) ) != 0 )
goto err_set_name;
}
}
return image;