commit 05d9e98b514d895a54eeaf799bc53ca22ba7f47b
parent 0c655c6feaffd0c6d4a22c8b5e49a5aeed068360
Author: hhvn <dev@hhvn.uk>
Date: Sat, 14 May 2022 18:28:31 +0100
Use assert_warn for values to alloc functions
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/mem.c b/src/mem.c
@@ -44,6 +44,7 @@ void *
emalloc(size_t size) {
void *mem;
+ assert_warn(size, NULL);
if ((mem = malloc(size)) == NULL) {
endwin();
perror("malloc()");
@@ -57,6 +58,7 @@ void *
erealloc(void *ptr, size_t size) {
void *mem;
+ assert_warn(ptr && size, NULL);
if ((mem = realloc(ptr, size)) == NULL) {
endwin();
perror("realloc()");
@@ -70,6 +72,7 @@ char *
estrdup(const char *str) {
char *ret;
+ assert_warn(str, NULL);
if ((ret = strdup(str)) == NULL) {
endwin();
perror("strdup()");
@@ -82,6 +85,7 @@ estrdup(const char *str) {
wchar_t *
ewcsdup(const wchar_t *str) {
wchar_t *ret;
+ assert_warn(str, NULL);
if ((ret = wcsdup(str)) == NULL) {
endwin();
perror("wcsdup()");