aboutsummaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2012-08-22 13:57:58 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2012-08-30 21:50:30 +0200
commit6cc3f92ea415736ed2461d5ae15eef82e72c2200 (patch)
treeaec775807adaffe82acf944d5b4c62f9ba350636 /src/input
parent81ed7599931b662c04c5a65bf1088102c4aa11cf (diff)
ipaccess: fix leak of e1inp_line
Holger reported a leak in the ipaccess_drop path and a patch to fix this. This is a new version of the patch posted that also handle the case in which only one of the link (OML / RSL) is established and no ID_RESP was received. Based on patch of Holger Freyther.
Diffstat (limited to 'src/input')
-rw-r--r--src/input/hsl.c3
-rw-r--r--src/input/ipaccess.c10
2 files changed, 4 insertions, 9 deletions
diff --git a/src/input/hsl.c b/src/input/hsl.c
index 3dcba1d..1a60c2b 100644
--- a/src/input/hsl.c
+++ b/src/input/hsl.c
@@ -83,9 +83,6 @@ static void hsl_drop(struct e1inp_line *line, struct osmo_fd *bfd)
close(bfd->fd);
bfd->fd = -1;
}
- /* put the virtual E1 line that we cloned for this socket, if
- * it becomes unused, it gets released. */
- e1inp_line_put(line);
}
static int process_hsl_rsl(struct msgb *msg, struct e1inp_line *line,
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 76d1994..a3c3b70 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -237,9 +237,6 @@ static int ipaccess_drop(struct osmo_fd *bfd)
int ret = 0;
struct e1inp_line *line = bfd->data;
- /* e1inp_sign_link_destroy releases the socket descriptors for us. */
- line->ops->sign_link_down(line);
-
/* Error case: we did not see any ID_RESP yet for this socket. */
if (bfd->fd != -1) {
LOGP(DLINP, LOGL_ERROR, "Forcing socket shutdown with "
@@ -249,9 +246,10 @@ static int ipaccess_drop(struct osmo_fd *bfd)
bfd->fd = -1;
ret = -ENOENT;
}
- /* put the virtual E1 line that we cloned for this socket, if
- * it becomes unused, it gets released. */
- e1inp_line_put(line);
+
+ /* e1inp_sign_link_destroy releases the socket descriptors for us. */
+ line->ops->sign_link_down(line);
+
return ret;
}