Fixed crash/freeze bug in compiler where free was being used on a bad pointer (was an oversight when adding deprecation support for macros)
authorScott Ehlert <ds@alliedmods.net>
Tue Aug 07 22:03:11 2007 +0000 (2007-08-07)
changeset 126713d77c75c6b9
parent 1266 ef8dd1cddc35
child 1268 9360f5ea2289
Fixed crash/freeze bug in compiler where free was being used on a bad pointer (was an oversight when adding deprecation support for macros)
sourcepawn/compiler/sclist.c
     1.1 --- a/sourcepawn/compiler/sclist.c	Tue Aug 07 18:55:44 2007 +0000
     1.2 +++ b/sourcepawn/compiler/sclist.c	Tue Aug 07 22:03:11 2007 +0000
     1.3 @@ -62,6 +62,7 @@
     1.4    cur->first=duplicatestring(first);
     1.5    cur->second=duplicatestring(second);
     1.6    cur->matchlength=matchlength;
     1.7 +  cur->documentation=NULL;
     1.8    if (cur->first==NULL || cur->second==NULL) {
     1.9      if (cur->first!=NULL)
    1.10        free(cur->first);
    1.11 @@ -343,6 +344,11 @@
    1.12      item=find_stringpair(item,name,length);
    1.13    if (item==NULL)
    1.14      return FALSE;
    1.15 +  if (item->documentation)
    1.16 +  {
    1.17 +    free(item->documentation);
    1.18 +    item->documentation=NULL;
    1.19 +  }
    1.20    delete_stringpair(&substpair,item);
    1.21    adjustindex(*name);
    1.22    return TRUE;