diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-03-09 20:04:00 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-03-09 20:04:00 +0800 |
commit | b9f232fd155fd9c8bf6428d49dfdd392bcc6779e (patch) | |
tree | f79769bc75ada057d4cd3a335d4732b2ac65d2e9 | |
parent | ccd9c81ff6d7365eb4c11f7b881ae6c00a037d58 (diff) | |
download | pttbbs-b9f232fd155fd9c8bf6428d49dfdd392bcc6779e.tar pttbbs-b9f232fd155fd9c8bf6428d49dfdd392bcc6779e.tar.gz pttbbs-b9f232fd155fd9c8bf6428d49dfdd392bcc6779e.tar.bz2 pttbbs-b9f232fd155fd9c8bf6428d49dfdd392bcc6779e.tar.lz pttbbs-b9f232fd155fd9c8bf6428d49dfdd392bcc6779e.tar.xz pttbbs-b9f232fd155fd9c8bf6428d49dfdd392bcc6779e.tar.zst pttbbs-b9f232fd155fd9c8bf6428d49dfdd392bcc6779e.zip |
add some assert() on malloc()
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1582 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/fav.c | 1 | ||||
-rw-r--r-- | mbbsd/read.c | 2 |
2 files changed, 3 insertions, 0 deletions
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; |