Make sure that freeptr actually points to something before we try to

invoke it.
This commit is contained in:
Robert James Kaes 2001-09-06 21:52:31 +00:00
parent f2312262c7
commit 4670eb5194

View File

@ -1,4 +1,4 @@
/* $Id: ternary.c,v 1.7 2001-09-04 17:53:41 rjkaes Exp $
/* $Id: ternary.c,v 1.8 2001-09-06 21:52:31 rjkaes Exp $
*
* This module creates a Ternary Search Tree which can store both string
* keys, and arbitrary data for each key. It works similar to a hash, and
@ -269,6 +269,7 @@ int ternary_destroy(TERNARY tno, void (*freeptr)(void *))
for (j = 0; j < BUFSIZE; j++) {
Tnode *ptr = (trees[cur]->freearr[i] + j);
if (ptr->splitchar == 0)
if (freeptr)
(*freeptr)(ptr->eqkid);
safefree(ptr);
}