[cvs] bogofilter/src wordhash.c,1.36,1.37
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <re...@us...> - 2004-01-04 21:35:48
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1:/tmp/cvs-serv24608 Modified Files: wordhash.c Log Message: Correct memory leak that whacks bogotune. Index: wordhash.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/wordhash.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- wordhash.c 4 Jan 2004 20:52:07 -0000 1.36 +++ wordhash.c 4 Jan 2004 21:35:45 -0000 1.37 @@ -504,21 +504,19 @@ convert_propslist_to_countlist(wordhash_t *whi) { hashnode_t *node; - wordhash_t *who = wordhash_init(WH_CNTS, whi->count); + wordhash_t *who = NULL; uint count = 0; if (whi->type == WH_CNTS) return whi; - if (whi->type == WH_NORMAL) - who = wordhash_init(WH_CNTS, whi->size); - else { - if (whi->type != WH_PROPS) { - fprintf(stderr, "convert_propslist_to_countlist() called with non-WH_PROPS parameter.\n"); - exit(EX_ERROR); - } - who = wordhash_init(WH_CNTS, whi->size); + if (whi->type != WH_NORMAL && + whi->type != WH_PROPS) { + fprintf(stderr, "convert_propslist_to_countlist() called with invalid input.\n"); + exit(EX_ERROR); } + + who = wordhash_init(WH_CNTS, whi->size); for(node = wordhash_first(whi); node != NULL; node = wordhash_next(whi)) { wordcnts_t *ci = wordhash_get_counts(whi, node); |