Skip to content

Commit

Permalink
[image] Avoid potential NULL pointer dereference
Browse files Browse the repository at this point in the history
Detected using Valgrind.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed May 8, 2012
1 parent 3e6e007 commit c124f21
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/image.c
Expand Up @@ -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;
Expand Down

0 comments on commit c124f21

Please sign in to comment.