fix:Resource leak: fp
Signed-off-by: yuxiaojun <yuxiaojun1011@outlook.com>
This commit is contained in:
parent
7bf5923052
commit
c350616038
|
@ -172,6 +172,7 @@ static struct elf_file *load_elf(const char *filename)
|
||||||
ef = (struct elf_file *)malloc(sizeof(*ef));
|
ef = (struct elf_file *)malloc(sizeof(*ef));
|
||||||
if (!ef)
|
if (!ef)
|
||||||
{
|
{
|
||||||
|
fclose(fp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,6 +183,7 @@ static struct elf_file *load_elf(const char *filename)
|
||||||
buf = (char *)malloc(fsize);
|
buf = (char *)malloc(fsize);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
|
fclose(fp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue