From: Alan T. DeKok Date: Fri, 17 Feb 2023 13:03:39 +0000 (-0500) Subject: free hp on error, too. Fixes #4903 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5d935fd6ddae4878a4af6c33d01cc9fcb8113bb;p=thirdparty%2Ffreeradius-server.git free hp on error, too. Fixes #4903 --- diff --git a/src/lib/util/minmax_heap.c b/src/lib/util/minmax_heap.c index 7cb80d006ba..e6fe0ad821e 100644 --- a/src/lib/util/minmax_heap.c +++ b/src/lib/util/minmax_heap.c @@ -122,7 +122,10 @@ fr_minmax_heap_t *_fr_minmax_heap_alloc(TALLOC_CTX *ctx, fr_minmax_heap_cmp_t cm * (talloc headers are big); */ h = (minmax_heap_t *)talloc_array(hp, uint8_t, sizeof(minmax_heap_t) + (sizeof(void *) * (init + 1))); - if (unlikely(!h)) return NULL; + if (unlikely(!h)) { + talloc_free(hp); + return NULL; + } talloc_set_type(h, minmax_heap_t); *h = (minmax_heap_t){