Skip to content

Commit

Permalink
uimage: fix memory leak in error path
Browse files Browse the repository at this point in the history
handle->name is dynamically allocated, so free it in the error path.

Signed-off-by: Sascha Hauer <[email protected]>
Reported-by: Stefan Lengfeld <[email protected]>
  • Loading branch information
saschahauer committed Jan 25, 2018
1 parent e660e51 commit 220e92b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/uimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ struct uimage_handle *uimage_open(const char *filename)
return handle;
err_out:
close(fd);

free(handle->name);
free(handle);
if (IS_BUILTIN(CONFIG_FS_TFTP) && !stat(uimage_tmp, &s))
unlink(uimage_tmp);
Expand Down

0 comments on commit 220e92b

Please sign in to comment.