summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-07-21 08:33:06 +0200
committerHarald Welte <laforge@gnumonks.org>2019-07-21 08:33:06 +0200
commita044bb6275492fbddbd0864e1820ccb08a70d107 (patch)
tree499cc2381a8cd18bed936739d6125091a4e0cd16 /src
parent5c2a64ca96b123fbfa317ada473e6f22819dabdc (diff)
osmocon: Fix file descriptor + mem leak in error path
Change-Id: I42ceed662889084783dc89f4ca39c3852428d108 Closes: CID#198539
Diffstat (limited to 'src')
-rw-r--r--src/host/osmocon/osmocon.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index 92372141..1bb0bb7d 100644
--- a/src/host/osmocon/osmocon.c
+++ b/src/host/osmocon/osmocon.c
@@ -1309,6 +1309,7 @@ static int tool_accept(struct osmo_fd *fd, unsigned int flags)
con = talloc_zero(NULL, struct tool_connection);
if (!con) {
fprintf(stderr, "Failed to create tool connection.\n");
+ close(rc);
return -1;
}
@@ -1320,6 +1321,8 @@ static int tool_accept(struct osmo_fd *fd, unsigned int flags)
con->fd.data = con;
if (osmo_fd_register(&con->fd) != 0) {
fprintf(stderr, "Failed to register the fd.\n");
+ talloc_free(con);
+ close(rc);
return -1;
}