image: Call image_free() when image_append() is failing
This commit is contained in:
1 parent
897919a70f
commit
1ec3777cb8
1 file changed
+4
-2
+4
-2
@@ -162,8 +162,10 @@ static int image_append(struct image * image, const char * type, const char * de
|
|||||||
image->hash = image_hash_from_data(image);
|
image->hash = image_hash_from_data(image);
|
||||||
|
|
||||||
image->devices = calloc(1, sizeof(struct device_list));
|
image->devices = calloc(1, sizeof(struct device_list));
|
||||||
if ( ! image->devices )
|
if ( ! image->devices ) {
|
||||||
return -1;
|
image_free(image);
|
||||||
|
ALLOC_ERROR_RETURN(-1);
|
||||||
|
}
|
||||||
|
|
||||||
image->devices->device = DEVICE_ANY;
|
image->devices->device = DEVICE_ANY;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user