Fix a bug which references undefined variable `ptr` (#195)
diff --git a/rpmalloc/rpmalloc.c b/rpmalloc/rpmalloc.c
index 975b341..966a80e 100644
--- a/rpmalloc/rpmalloc.c
+++ b/rpmalloc/rpmalloc.c
@@ -3100,7 +3100,7 @@
#if ENABLE_VALIDATE_ARGS
if (size >= MAX_ALLOC_SIZE) {
errno = EINVAL;
- return ptr;
+ return 0;
}
#endif
return _rpmalloc_allocate(heap, size);
@@ -3111,7 +3111,7 @@
#if ENABLE_VALIDATE_ARGS
if (size >= MAX_ALLOC_SIZE) {
errno = EINVAL;
- return ptr;
+ return 0;
}
#endif
return _rpmalloc_aligned_allocate(heap, alignment, size);