From: Brian Demsky Date: Fri, 20 Jul 2012 21:48:01 +0000 (-0700) Subject: fix some allocation/free bugs when we put non objects into table... X-Git-Tag: pldi2013~312 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e3da449eadbf2c92bb80b8fff073c0fa7aea5ede;p=model-checker.git fix some allocation/free bugs when we put non objects into table... --- 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;