| commit | ef0c74de9320c86ab1f08e5f9c15b031ed36d01f | [log] [tgz] |
|---|---|---|
| author | Petr Machata <pmachata@redhat.com> | Sat Oct 27 00:30:57 2012 +0200 |
| committer | Petr Machata <pmachata@redhat.com> | Sat Oct 27 00:30:57 2012 +0200 |
| tree | 28cb78e603589c2d758130604a7f3cbb3e4ae397 | |
| parent | 8a98e6f756c7e6a4171e7dee563f0efbb28b9f33 [diff] [blame] |
Fix memory handling of pid2name result This plugs a leak.
diff --git a/ltrace-elf.c b/ltrace-elf.c index 020159c..ce7fd3d 100644 --- a/ltrace-elf.c +++ b/ltrace-elf.c
@@ -959,11 +959,14 @@ * that. Presumably we could read the DSOs from the process * memory image, but that's not currently done. */ char *fname = pid2name(proc->pid); + if (fname == NULL) + return NULL; if (read_module(lib, proc, fname, 0, 1) < 0) { library_destroy(lib); free(lib); return NULL; } + free(fname); return lib; }