From e3da449eadbf2c92bb80b8fff073c0fa7aea5ede Mon Sep 17 00:00:00 2001 From: Brian Demsky Date: Fri, 20 Jul 2012 14:48:01 -0700 Subject: [PATCH] fix some allocation/free bugs when we put non objects into table... --- hashtable.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hashtable.h b/hashtable.h index c877d9f..4eae757 100644 --- a/hashtable.h +++ b/hashtable.h @@ -36,7 +36,7 @@ template * bin = table[i]; while(bin!=NULL) { struct hashlistnode<_Key,_Val> * next=bin->next; - _free(bin); + delete bin; bin=next; } } @@ -65,7 +65,7 @@ template * bin = table[i]; while(bin!=NULL) { struct hashlistnode<_Key,_Val> * next=bin->next; - _free(bin); + delete bin; bin=next; } } @@ -93,7 +93,7 @@ templatenext; } - struct hashlistnode<_Key,_Val> *newptr=(struct hashlistnode<_Key,_Val> *)_malloc(sizeof(struct hashlistnode<_Key,_Val>)); + struct hashlistnode<_Key,_Val> *newptr=(struct hashlistnode<_Key,_Val> *)new struct hashlistnode<_Key,_Val>; newptr->key=key; newptr->val=val; newptr->next=ptr; -- 2.34.1