mirror of
https://github.com/ipxe/ipxe
synced 2026-02-14 02:31:26 +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 )
|
if ( replacement )
|
||||||
assert ( replacement->flags & IMAGE_REGISTERED );
|
assert ( replacement->flags & IMAGE_REGISTERED );
|
||||||
|
|
||||||
|
/* Clear any recorded replacement image */
|
||||||
|
image_put ( image->replacement );
|
||||||
|
image->replacement = NULL;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
/* Unregister image if applicable */
|
/* Unregister image if applicable */
|
||||||
if ( image->flags & IMAGE_AUTO_UNREGISTER )
|
if ( image->flags & IMAGE_AUTO_UNREGISTER )
|
||||||
|
|||||||
Reference in New Issue
Block a user