libpayload: fix leak in libcbfs
stage wasn't freed on errors. Change-Id: I10d2f42f3e484955619addbef2898981f6f90a35 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Found-by: Coverity Scan #1347345 Reviewed-on: https://review.coreboot.org/15958 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
This commit is contained in:
parent
41b3196bc8
commit
33ab4fea23
|
@ -116,8 +116,10 @@ void * cbfs_load_stage(struct cbfs_media *media, const char *name)
|
|||
sizeof(struct cbfs_stage),
|
||||
(void *) (uintptr_t) stage->load,
|
||||
stage->len);
|
||||
if (!final_size)
|
||||
return (void *) -1;
|
||||
if (!final_size) {
|
||||
entry = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset((void *)((uintptr_t)stage->load + final_size), 0,
|
||||
stage->memlen - final_size);
|
||||
|
@ -127,6 +129,7 @@ void * cbfs_load_stage(struct cbfs_media *media, const char *name)
|
|||
entry = stage->entry;
|
||||
// entry = ntohll(stage->entry);
|
||||
|
||||
out:
|
||||
free(stage);
|
||||
return (void *) entry;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue