Skip to content

Commit

Permalink
uprobes: don't leak one fd per uprobe created
Browse files Browse the repository at this point in the history
An unfortunate typo led to us leaking one fd to uprobe_events
every time we created a uprobe.  (Spotted when creating thousands of
them, and dtprobed ran out of fds.)

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
nickalcock authored and kvanhees committed May 25, 2023
1 parent 87c69bc commit 00d36ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libcommon/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ uprobe_create_named(dev_t dev, ino_t ino, uint64_t addr, const char *spec, int i
args ? args : "");

out:
if (fd == -1)
if (fd != -1)
close(fd);
free(args);
if (rc < 0) {
Expand Down

0 comments on commit 00d36ab

Please sign in to comment.