summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-02-16 01:26:30 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-02-16 01:35:08 +0100
commit4a8a9f4210b01c3b8b75eb3b984c9127e90d8c54 (patch)
treeeb232c7ce7ebf59398ca0ebecd923bd2050a37e2 /src
parenta4952aa43625140ec7e9f2e892d938d16ee7ae88 (diff)
memleak: _gsmtap_raw_output(): free msg in case of vsnprintf failure
Don't just return, free the allocated msg first. Change-Id: I51431ae7baca33ce5bab085cc3efe25f1a10b6d1
Diffstat (limited to 'src')
-rw-r--r--src/logging_gsmtap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/logging_gsmtap.c b/src/logging_gsmtap.c
index c53a0abe..f17f292e 100644
--- a/src/logging_gsmtap.c
+++ b/src/logging_gsmtap.c
@@ -99,8 +99,10 @@ static void _gsmtap_raw_output(struct log_target *target, int subsys,
golh->ts.usec = osmo_htonl(tv.tv_usec);
rc = vsnprintf((char *) msg->tail, msgb_tailroom(msg), format, ap);
- if (rc < 0)
+ if (rc < 0) {
+ msgb_free(msg);
return;
+ }
msgb_put(msg, rc);
rc = gsmtap_sendmsg(target->tgt_gsmtap.gsmtap_inst, msg);