diff options
| author | Mark Wielaard <[email protected]> | 2012-12-11 14:21:01 +0100 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2012-12-11 22:37:45 +0100 |
| commit | 76c54597cad951a8027d8b1a5f19eb557c22ebcb (patch) | |
| tree | 6d45886bd730e64f3db720f97706800bc3908ed6 /libdwfl/linux-kernel-modules.c | |
| parent | 7df3d2cd70932cd70515dbeb75e4db66fd27f192 (diff) | |
Fix two failure condition checks in libdwfl/linux-kernel-modules.c.
In report_kernel () if find_kernel_elf () fails then fname hasn't been
allocated or already freed. Don't free it again.
Brackets around unlikely expression in report_kernel_archive were incorrect
making the check always succeed.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdwfl/linux-kernel-modules.c')
| -rw-r--r-- | libdwfl/linux-kernel-modules.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c index bafe53c0..9bf5f255 100644 --- a/libdwfl/linux-kernel-modules.c +++ b/libdwfl/linux-kernel-modules.c @@ -225,12 +225,12 @@ report_kernel (Dwfl *dwfl, const char **release, mod->e_type = ET_DYN; } + free (fname); + if (!report || result < 0) close (fd); } - free (fname); - return result; } @@ -247,7 +247,7 @@ report_kernel_archive (Dwfl *dwfl, const char **release, char *archive; if (unlikely ((*release)[0] == '/' ? asprintf (&archive, "%s/debug.a", *release) - : asprintf (&archive, MODULEDIRFMT "/debug.a", *release)) < 0) + : asprintf (&archive, MODULEDIRFMT "/debug.a", *release) < 0)) return ENOMEM; int fd = try_kernel_name (dwfl, &archive, false); |
