Bläddra i källkod

[image] Fix use-after-free in debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 år sedan
förälder
incheckning
275fdae9bb
1 ändrade filer med 3 tillägg och 3 borttagningar
  1. 3
    3
      src/core/image.c

+ 3
- 3
src/core/image.c Visa fil

67
 static void free_image ( struct refcnt *refcnt ) {
67
 static void free_image ( struct refcnt *refcnt ) {
68
 	struct image *image = container_of ( refcnt, struct image, refcnt );
68
 	struct image *image = container_of ( refcnt, struct image, refcnt );
69
 
69
 
70
+	DBGC ( image, "IMAGE %s freed\n", image->name );
70
 	free ( image->name );
71
 	free ( image->name );
71
 	free ( image->cmdline );
72
 	free ( image->cmdline );
72
 	uri_put ( image->uri );
73
 	uri_put ( image->uri );
73
 	ufree ( image->data );
74
 	ufree ( image->data );
74
 	image_put ( image->replacement );
75
 	image_put ( image->replacement );
75
 	free ( image );
76
 	free ( image );
76
-	DBGC ( image, "IMAGE %s freed\n", image->name );
77
 }
77
 }
78
 
78
 
79
 /**
79
 /**
327
 
327
 
328
 	/* Tail-recurse into replacement image, if one exists */
328
 	/* Tail-recurse into replacement image, if one exists */
329
 	if ( replacement ) {
329
 	if ( replacement ) {
330
-		DBGC ( image, "IMAGE %s replacing self with IMAGE %s\n",
331
-		       image->name, replacement->name );
330
+		DBGC ( image, "IMAGE <freed> replacing self with IMAGE %s\n",
331
+		       replacement->name );
332
 		if ( ( rc = image_exec ( replacement ) ) != 0 )
332
 		if ( ( rc = image_exec ( replacement ) ) != 0 )
333
 			return rc;
333
 			return rc;
334
 	}
334
 	}

Laddar…
Avbryt
Spara