diff options
author | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-02-23 09:23:44 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-02-23 09:23:44 +0100 |
commit | a6e69e4dcfd4a3b6543e89ac7c39089a7db42c75 (patch) | |
tree | ce5b5c870a727d3c6bacc1a0dc79a29470ed9767 | |
parent | 50f3254c2356927e2232f63bcf1b3b49c70cded2 (diff) | |
download | v4l-utils-a6e69e4dcfd4a3b6543e89ac7c39089a7db42c75.tar.gz |
libdvbv5: dvb-dev-remote: don't leak resources at send_buf()
If errors occur, ensure that the message buffer will be freed.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r-- | lib/libdvbv5/dvb-dev-remote.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libdvbv5/dvb-dev-remote.c b/lib/libdvbv5/dvb-dev-remote.c index 07ab35a6..8935db4d 100644 --- a/lib/libdvbv5/dvb-dev-remote.c +++ b/lib/libdvbv5/dvb-dev-remote.c @@ -347,6 +347,7 @@ static struct queued_msg *send_buf(struct dvb_device_priv *dvb, int fd, dvb_logdbg("buffer to short for int32_t"); stack_dump(parms); pthread_mutex_unlock(&priv->lock_io); + free(msg); return NULL; } memcpy(p, &i32, 4); @@ -359,6 +360,7 @@ static struct queued_msg *send_buf(struct dvb_device_priv *dvb, int fd, p - buf, len, sizeof(buf)); stack_dump(parms); pthread_mutex_unlock(&priv->lock_io); + free(msg); return NULL; } i32 = htobe32(len); @@ -372,6 +374,7 @@ static struct queued_msg *send_buf(struct dvb_device_priv *dvb, int fd, dvb_logdbg("buffer to big!"); stack_dump(parms); pthread_mutex_unlock(&priv->lock_io); + free(msg); return NULL; } |