libCom: Fix use-after-free bug in macCore.c

This commit is contained in:
Andrew Johnson
2014-10-30 17:55:12 -05:00
parent 6c14dc194c
commit 09ff608ca9

View File

@@ -259,9 +259,10 @@ epicsShareAPI macPutValue(
* a macro from all scopes will still be needed by iocshEnvClear
*/
while ( ( entry = lookup( handle, name, FALSE ) ) != NULL ) {
int done = strcmp(entry->type, "environment variable") == 0;
delete( handle, entry );
if (strcmp(entry->type, "environment variable") == 0)
if (done)
break;
}