mirror of
https://github.com/ipxe/ipxe
synced 2025-12-07 18:00:28 +03:00
[image] Clear recorded replacement image immediately after consuming
If an embedded script uses "chain --replace", the embedded image will retain a reference to the replacement image in perpetuity. Fix by clearing any recorded replacement image immediately in image_exec(), instead of relying upon image_free() to drop the reference. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -447,6 +447,10 @@ int image_exec ( struct image *image ) {
|
||||
if ( replacement )
|
||||
assert ( replacement->flags & IMAGE_REGISTERED );
|
||||
|
||||
/* Clear any recorded replacement image */
|
||||
image_put ( image->replacement );
|
||||
image->replacement = NULL;
|
||||
|
||||
err:
|
||||
/* Unregister image if applicable */
|
||||
if ( image->flags & IMAGE_AUTO_UNREGISTER )
|
||||
|
||||
Reference in New Issue
Block a user