jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/34036 )
Change subject: dahdi: Add msgb_free() to prevent memeory leaks ......................................................................
dahdi: Add msgb_free() to prevent memeory leaks
Change-Id: I862dfa80dc195639552f99ec0734ec94290a7bb5 --- M src/input/dahdi.c 1 file changed, 15 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/36/34036/1
diff --git a/src/input/dahdi.c b/src/input/dahdi.c index 2120575..7838866 100644 --- a/src/input/dahdi.c +++ b/src/input/dahdi.c @@ -179,10 +179,12 @@ handle_dahdi_exception(e1i_ts); else if (ret < 0) { LOGPITS(e1i_ts, DLMI, LOGL_ERROR, "%s read failed %d (%s)\n", __func__, ret, strerror(errno)); + msgb_free(msg); return ret; } if (ret <= 3) { LOGPITS(e1i_ts, DLMI, LOGL_ERROR, "%s read failed %d (%s)\n", __func__, ret, strerror(errno)); + msgb_free(msg); return ret; } msgb_put(msg, ret - 2); @@ -316,10 +318,12 @@ handle_dahdi_exception(e1i_ts); else if (ret < 0) { LOGPITS(e1i_ts, DLMI, LOGL_ERROR, "%s read failed %d (%s)\n", __func__, ret, strerror(errno)); + msgb_free(msg); return ret; } if (ret <= 3) { LOGPITS(e1i_ts, DLMI, LOGL_ERROR, "%s read failed %d (%s)\n", __func__, ret, strerror(errno)); + msgb_free(msg); return ret; } msgb_put(msg, ret - 2); @@ -377,6 +381,7 @@ ret = read(bfd->fd, msg->data, D_TSX_ALLOC_SIZE); if (ret < 0 || ret != D_TSX_ALLOC_SIZE) { LOGPITS(e1i_ts, DLINP, LOGL_DEBUG, "read error %d %s\n", ret, strerror(errno)); + msgb_free(msg); return ret; }
@@ -446,6 +451,7 @@ ret = read(bfd->fd, msg->data, D_TSX_ALLOC_SIZE); if (ret < 0 || ret != D_TSX_ALLOC_SIZE) { LOGPITS(e1i_ts, DLINP, LOGL_DEBUG, "read error %d %s\n", ret, strerror(errno)); + msgb_free(msg); return ret; }