]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[image] Fix use-after-free in debug messages
authorMichael Brown <mcb30@ipxe.org>
Fri, 30 Mar 2012 19:50:25 +0000 (20:50 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 30 Mar 2012 19:50:25 +0000 (20:50 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/image.c

index 3cb2d62dabaa978ff69f7eec59460b6410aba1f2..1058092574e6e3dd5c7533174d2b1bf4133999ca 100644 (file)
@@ -67,13 +67,13 @@ static int require_trusted_images_permanent = 0;
 static void free_image ( struct refcnt *refcnt ) {
        struct image *image = container_of ( refcnt, struct image, refcnt );
 
+       DBGC ( image, "IMAGE %s freed\n", image->name );
        free ( image->name );
        free ( image->cmdline );
        uri_put ( image->uri );
        ufree ( image->data );
        image_put ( image->replacement );
        free ( image );
-       DBGC ( image, "IMAGE %s freed\n", image->name );
 }
 
 /**
@@ -327,8 +327,8 @@ int image_exec ( struct image *image ) {
 
        /* Tail-recurse into replacement image, if one exists */
        if ( replacement ) {
-               DBGC ( image, "IMAGE %s replacing self with IMAGE %s\n",
-                      image->name, replacement->name );
+               DBGC ( image, "IMAGE <freed> replacing self with IMAGE %s\n",
+                      replacement->name );
                if ( ( rc = image_exec ( replacement ) ) != 0 )
                        return rc;
        }