Pārlūkot izejas kodu

[image] Avoid potential NULL pointer dereference

Detected using Valgrind.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 gadus atpakaļ
vecāks
revīzija
c124f21f56
1 mainītis faili ar 5 papildinājumiem un 3 dzēšanām
  1. 5
    3
      src/core/image.c

+ 5
- 3
src/core/image.c Parādīt failu

96
 	ref_init ( &image->refcnt, free_image );
96
 	ref_init ( &image->refcnt, free_image );
97
 	if ( uri ) {
97
 	if ( uri ) {
98
 		image->uri = uri_get ( uri );
98
 		image->uri = uri_get ( uri );
99
-		name = basename ( ( char * ) uri->path );
100
-		if ( ( rc = image_set_name ( image, name ) ) != 0 )
101
-			goto err_set_name;
99
+		if ( uri->path ) {
100
+			name = basename ( ( char * ) uri->path );
101
+			if ( ( rc = image_set_name ( image, name ) ) != 0 )
102
+				goto err_set_name;
103
+		}
102
 	}
104
 	}
103
 
105
 
104
 	return image;
106
 	return image;

Notiek ielāde…
Atcelt
Saglabāt