From: Arran Cudbard-Bell Date: Thu, 29 Feb 2024 15:53:27 +0000 (-0600) Subject: Satisfy the pedants X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb97581c39270e8545fe2f15d64d12ba846f646c;p=thirdparty%2Ffreeradius-server.git Satisfy the pedants --- diff --git a/src/lib/util/value.c b/src/lib/util/value.c index 8be01e3f5c0..34b8451234d 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -4371,13 +4371,18 @@ int fr_value_box_mem_realloc(TALLOC_CTX *ctx, uint8_t **out, fr_value_box_t *dst bin = talloc_realloc(ctx, cbin, uint8_t, len); } else { bin = talloc_array(ctx, uint8_t, 0); - talloc_free(cbin); } if (!bin) { fr_strerror_printf("Failed reallocing value box buffer to %zu bytes", len); return -1; } + /* + * Only free the original buffer once we've allocated + * a new empty array. + */ + if (len == 0) talloc_free(cbin); + /* * Zero out the additional bytes */