diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-09-17 02:45:51 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-09-17 02:45:51 +0800 |
commit | 772c97ab76a8efc28e61b98ba1d1c099092441b8 (patch) | |
tree | c93f8b298ebe66796d32bd35940f1e696b7fbd37 | |
parent | 83d93227d399ba3c9a4452914fefb2d657e9218d (diff) | |
download | pttbbs-772c97ab76a8efc28e61b98ba1d1c099092441b8.tar pttbbs-772c97ab76a8efc28e61b98ba1d1c099092441b8.tar.gz pttbbs-772c97ab76a8efc28e61b98ba1d1c099092441b8.tar.bz2 pttbbs-772c97ab76a8efc28e61b98ba1d1c099092441b8.tar.lz pttbbs-772c97ab76a8efc28e61b98ba1d1c099092441b8.tar.xz pttbbs-772c97ab76a8efc28e61b98ba1d1c099092441b8.tar.zst pttbbs-772c97ab76a8efc28e61b98ba1d1c099092441b8.zip |
fix malloc(0) error when number of hotboard is 0.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3418 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/board.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c index 5903401b..bb23d3ba 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -315,6 +315,12 @@ load_boards(char *key) #if HOTBOARDCACHE else if(IN_HOTBOARD()){ nbrdsize = SHM->nHOTs; + if(nbrdsize == 0) { + nbrdsize = 1; + nbrd = (boardstat_t *)malloc(sizeof(boardstat_t) * 1); + addnewbrdstat(0, 0); // dummy + return; + } assert(0<nbrdsize); nbrd = (boardstat_t *)malloc(sizeof(boardstat_t) * nbrdsize); for( i = 0 ; i < nbrdsize; ++i ) { |