Browse Source

Add free_image

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
742f242863
2 changed files with 18 additions and 0 deletions
  1. 17
    0
      src/core/image.c
  2. 1
    0
      src/include/gpxe/image.h

+ 17
- 0
src/core/image.c View File

89
 	return NULL;
89
 	return NULL;
90
 }
90
 }
91
 
91
 
92
+/**
93
+ * Free loaded image
94
+ *
95
+ * @v image		Executable/loadable image
96
+ *
97
+ * This releases the memory being used to store the image; it does not
98
+ * release the @c struct @c image itself, nor does it unregister the
99
+ * image.
100
+ */
101
+void free_image ( struct image *image ) {
102
+	if ( image->free )
103
+		image->free ( image->data );
104
+	image->free = NULL;
105
+	image->data = UNULL;
106
+	image->len = 0;
107
+}
108
+
92
 /**
109
 /**
93
  * Load executable/loadable image into memory
110
  * Load executable/loadable image into memory
94
  *
111
  *

+ 1
- 0
src/include/gpxe/image.h View File

109
 extern int register_image ( struct image *image );
109
 extern int register_image ( struct image *image );
110
 extern void unregister_image ( struct image *image );
110
 extern void unregister_image ( struct image *image );
111
 struct image * find_image ( const char *name );
111
 struct image * find_image ( const char *name );
112
+extern void free_image ( struct image *image );
112
 extern int image_load ( struct image *image );
113
 extern int image_load ( struct image *image );
113
 extern int image_autoload ( struct image *image );
114
 extern int image_autoload ( struct image *image );
114
 extern int image_exec ( struct image *image );
115
 extern int image_exec ( struct image *image );

Loading…
Cancel
Save