Skip to content

Commit

Permalink
[image] Fix use-after-free in debug messages
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Mar 30, 2012
1 parent f5c644c commit 275fdae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/image.c
Expand Up @@ -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 );
}

/**
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 275fdae

Please sign in to comment.