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/proc.c b/proc.c index 6b0cf97..e601e15 100644 --- a/proc.c +++ b/proc.c
@@ -440,13 +440,15 @@ * 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;