]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Satisfy the pedants
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 29 Feb 2024 15:53:27 +0000 (09:53 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 29 Feb 2024 15:53:27 +0000 (09:53 -0600)
src/lib/util/value.c

index 8be01e3f5c068cb2e50a6831a000aa117d1817a4..34b8451234d75456e4c6b1300f26e1c4b09ef0bc 100644 (file)
@@ -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
         */