From b9f232fd155fd9c8bf6428d49dfdd392bcc6779e Mon Sep 17 00:00:00 2001 From: kcwu Date: Tue, 9 Mar 2004 12:04:00 +0000 Subject: add some assert() on malloc() git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1582 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/fav.c | 1 + mbbsd/read.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/mbbsd/fav.c b/mbbsd/fav.c index eb1a838d..c06a9628 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -178,6 +178,7 @@ static int get_type_size(int type) inline static void* fav_malloc(int size){ void *p = (void *)malloc(size); + assert(p); memset(p, 0, size); return p; } diff --git a/mbbsd/read.c b/mbbsd/read.c index 537a1921..1c2e5de1 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -198,7 +198,9 @@ getkeep(char *s, int def_topline, int def_cursline) else def_cursline = -def_cursline; p = (keeploc_t *) malloc(sizeof(keeploc_t)); + assert(p); p->key = (char *)malloc(strlen(s) + 1); + assert(p->key); strcpy(p->key, s); p->top_ln = def_topline; p->crs_ln = def_cursline; -- cgit v1.2.3