diff options
| author | Michael Brown | 2007-01-12 07:26:59 +0100 |
|---|---|---|
| committer | Michael Brown | 2007-01-12 07:26:59 +0100 |
| commit | 742f24286359486e31809e028c06929340106284 (patch) | |
| tree | ae79e52278080d21a90999f444a35fdded38d7c7 /src | |
| parent | Add basic "fetch" and "imgstat" commands. (diff) | |
| download | ipxe-742f24286359486e31809e028c06929340106284.tar.gz ipxe-742f24286359486e31809e028c06929340106284.tar.xz ipxe-742f24286359486e31809e028c06929340106284.zip | |
Add free_image
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/image.c | 17 | ||||
| -rw-r--r-- | src/include/gpxe/image.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/core/image.c b/src/core/image.c index e14e08f14..51998982e 100644 --- a/src/core/image.c +++ b/src/core/image.c @@ -90,6 +90,23 @@ struct image * find_image ( const char *name ) { } /** + * Free loaded image + * + * @v image Executable/loadable image + * + * This releases the memory being used to store the image; it does not + * release the @c struct @c image itself, nor does it unregister the + * image. + */ +void free_image ( struct image *image ) { + if ( image->free ) + image->free ( image->data ); + image->free = NULL; + image->data = UNULL; + image->len = 0; +} + +/** * Load executable/loadable image into memory * * @v image Executable/loadable image diff --git a/src/include/gpxe/image.h b/src/include/gpxe/image.h index fc955c2e8..7f11e6a0c 100644 --- a/src/include/gpxe/image.h +++ b/src/include/gpxe/image.h @@ -109,6 +109,7 @@ extern struct list_head images; extern int register_image ( struct image *image ); extern void unregister_image ( struct image *image ); struct image * find_image ( const char *name ); +extern void free_image ( struct image *image ); extern int image_load ( struct image *image ); extern int image_autoload ( struct image *image ); extern int image_exec ( struct image *image ); |
