diff options
author | Petr Machata <pmachata@redhat.com> | 2012-10-27 00:30:57 +0200 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2012-10-27 00:30:57 +0200 |
commit | ef0c74de9320c86ab1f08e5f9c15b031ed36d01f (patch) | |
tree | 28cb78e603589c2d758130604a7f3cbb3e4ae397 /proc.c | |
parent | 8a98e6f756c7e6a4171e7dee563f0efbb28b9f33 (diff) | |
download | ltrace-ef0c74de9320c86ab1f08e5f9c15b031ed36d01f.tar.gz |
Fix memory handling of pid2name result
This plugs a leak.
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -440,13 +440,15 @@ open_one_pid(pid_t pid) * easily free it, untracing is more work. */ if ((filename = pid2name(pid)) == NULL || trace_pid(pid) < 0) { + fail: free(filename); return -1; } proc = open_program(filename, pid); if (proc == NULL) - return -1; + goto fail; + free(filename); trace_set_options(proc); return 0; |