commit 3ced0bd025bbcbfcc36c8fa6ef1a03a89a83fd83
parent ebb371e6409074aa037052c83c93ccc110232f28
Author: Drew DeVault <sir@cmpwn.com>
Date: Fri, 12 Feb 2021 14:33:47 -0500
rt::realloc: free on zero size
Had a memory leak here
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/rt/malloc.ha b/rt/malloc.ha
@@ -136,6 +136,7 @@ fn free_small(p: *void, s: size) void = {
// request.
export fn realloc(_p: nullable *void, n: size) nullable *void = {
if (n == 0) {
+ free_(_p);
return null;
} else if (_p == null) {
return malloc(n);