]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
free hp on error, too. Fixes #4903
authorAlan T. DeKok <aland@freeradius.org>
Fri, 17 Feb 2023 13:03:39 +0000 (08:03 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 17 Feb 2023 13:03:58 +0000 (08:03 -0500)
src/lib/util/minmax_heap.c

index 7cb80d006babba82a706f75793162f352e697b83..e6fe0ad821e841652ff2c84dc9b3499e98c5bba1 100644 (file)
@@ -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){