diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-28 17:43:44 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-28 17:43:44 +0800 |
commit | feace6bb7d989fbf8f8f45cda34b8d60da844ed9 (patch) | |
tree | 277090645c30fb5c974ca6396f730441fadd1d8b /mbbsd/fav.c | |
parent | 6dda73a2fe9b365bfd979859b924b463976a0ca6 (diff) | |
download | pttbbs-feace6bb7d989fbf8f8f45cda34b8d60da844ed9.tar pttbbs-feace6bb7d989fbf8f8f45cda34b8d60da844ed9.tar.gz pttbbs-feace6bb7d989fbf8f8f45cda34b8d60da844ed9.tar.bz2 pttbbs-feace6bb7d989fbf8f8f45cda34b8d60da844ed9.tar.lz pttbbs-feace6bb7d989fbf8f8f45cda34b8d60da844ed9.tar.xz pttbbs-feace6bb7d989fbf8f8f45cda34b8d60da844ed9.tar.zst pttbbs-feace6bb7d989fbf8f8f45cda34b8d60da844ed9.zip |
fix memory leak
make sure malloc get memory
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3100 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/fav.c')
-rw-r--r-- | mbbsd/fav.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 1510347e..35c3f417 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -630,8 +630,6 @@ static void fav_free_branch(fav_t *fp) return; for(i = 0; i < fp->DataTail; i++){ ft = &fp->favh[i]; - if (!valid_item(ft)) - continue; switch(get_item_type(ft)){ case FAVT_FOLDER: fav_free_branch(cast_folder(ft)->this_folder); @@ -642,7 +640,6 @@ static void fav_free_branch(fav_t *fp) free(ft->fp); break; } - fav_remove(fp, ft); } free(fp->favh); free(fp); @@ -1115,7 +1112,8 @@ int updatenewfav(int mode) assert(numboards>=0); brdnum = numboards; /* avoid race */ - brd = (char *)malloc((brdnum + 1) * sizeof(char)); + if ((brd = (char *)malloc((brdnum + 1) * sizeof(char))) == NULL) + return -1; memset(brd, 0, (brdnum + 1) * sizeof(char)); i = read(fd, brd, brdnum * sizeof(char)); |