summaryrefslogtreecommitdiff
path: root/payloads
diff options
context:
space:
mode:
Diffstat (limited to 'payloads')
-rw-r--r--payloads/libpayload/libcbfs/cbfs_core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/payloads/libpayload/libcbfs/cbfs_core.c b/payloads/libpayload/libcbfs/cbfs_core.c
index 7e660ce83c..91f2603446 100644
--- a/payloads/libpayload/libcbfs/cbfs_core.c
+++ b/payloads/libpayload/libcbfs/cbfs_core.c
@@ -148,6 +148,7 @@ struct cbfs_handle *cbfs_get_handle(struct cbfs_media *media, const char *name)
if (get_cbfs_range(&offset, &cbfs_end, media)) {
ERROR("Failed to find cbfs range\n");
+ free(handle);
return NULL;
}
@@ -155,6 +156,7 @@ struct cbfs_handle *cbfs_get_handle(struct cbfs_media *media, const char *name)
media = &handle->media;
if (init_default_cbfs_media(media) != 0) {
ERROR("Failed to initialize default media.\n");
+ free(handle);
return NULL;
}
} else {
@@ -215,6 +217,7 @@ struct cbfs_handle *cbfs_get_handle(struct cbfs_media *media, const char *name)
}
media->close(media);
LOG("WARNING: '%s' not found.\n", name);
+ free(handle);
return NULL;
}