From 2eaa467b34d78b216a1ba9305bd23a9196209b3b Mon Sep 17 00:00:00 2001 From: Evan Huus Date: Thu, 22 Jan 2015 20:53:24 -0500 Subject: oids: fix memory leak In oid_encoded2subid_sub(), the scope we get may be NULL, in which case if we don't return our allocated buffer, it is our responsibility to free it. Minor regression from ge333e4c90f0aca41b0a56cef22fd80d0b0e73e14. Bug: 10883 Change-Id: I324ca770278ab0575511c5e9ab72b70d6ac1a391 Reviewed-on: https://code.wireshark.org/review/6748 Reviewed-by: Evan Huus --- epan/oids.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'epan/oids.c') diff --git a/epan/oids.c b/epan/oids.c index 463fe692b9..7489b2792c 100644 --- a/epan/oids.c +++ b/epan/oids.c @@ -1009,7 +1009,10 @@ guint oid_encoded2subid_sub(wmem_allocator_t *scope, const guint8 *oid_bytes, gi } if( subids >= subid_overflow || subid > 0xffffffff) { - *subids_p=NULL; + /* scope may be NULL in which case we must free our + * useless buffer before returning */ + wmem_free(scope, *subids_p); + *subids_p = NULL; return 0; } -- cgit v1.2.1