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 <eapache@gmail.com>
This commit is contained in:
Evan Huus 2015-01-22 20:53:24 -05:00
parent 612e286b9e
commit 2eaa467b34
1 changed files with 4 additions and 1 deletions

View File

@ -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;
}