diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-09-17 02:46:59 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-09-17 02:46:59 +0800 |
commit | c02336912143e1011229cd69f278804eb127a07f (patch) | |
tree | 123a9d98156cbbd6cd23574c84d39a1cfe6e36e2 | |
parent | e72482234de3aaca436c044b69e57a30202a7211 (diff) | |
download | pttbbs-c02336912143e1011229cd69f278804eb127a07f.tar pttbbs-c02336912143e1011229cd69f278804eb127a07f.tar.gz pttbbs-c02336912143e1011229cd69f278804eb127a07f.tar.bz2 pttbbs-c02336912143e1011229cd69f278804eb127a07f.tar.lz pttbbs-c02336912143e1011229cd69f278804eb127a07f.tar.xz pttbbs-c02336912143e1011229cd69f278804eb127a07f.tar.zst pttbbs-c02336912143e1011229cd69f278804eb127a07f.zip |
dirty hack to fix fav memory leak.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3421 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/fav.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 93bb6610..98c04bfb 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -256,13 +256,16 @@ inline static void* fav_malloc(int size){ static fav_type_t *fav_item_allocate(int type) { int size; + static fav_type_t ft_tmp; fav_type_t *ft; size = get_type_size(type); if (!size) return NULL; - ft = (fav_type_t *)fav_malloc(sizeof(fav_type_t)); + // XXX memory leak, dirty hack... + //ft = (fav_type_t *)fav_malloc(sizeof(fav_type_t)); + ft = &ft_tmp; ft->fp = fav_malloc(size); ft->type = type; return ft; @@ -983,6 +986,7 @@ inline static int fav_remove_tagged_item(fav_t *fp){ static int add_and_remove_tag(fav_t *fp, fav_type_t *ft) { fav_type_t *tmp; + fav_type_t ft_tmp; // do not remove the folder if it's on the stack if (get_item_type(ft) == FAVT_FOLDER) { int i; @@ -993,7 +997,9 @@ static int add_and_remove_tag(fav_t *fp, fav_type_t *ft) } } } - tmp = fav_malloc(sizeof(fav_type_t)); + // XXX memory leak, dirty hack + //tmp = fav_malloc(sizeof(fav_type_t)); + tmp = &ft_tmp; fav_item_copy(tmp, ft); /* since fav_item_copy is symbolic link, we disable removed link to * prevent double-free when doing fav_clean(). */ |