From 09ff608ca9a76cb7e542c82beea54267d354fdfd Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 30 Oct 2014 17:55:12 -0500 Subject: [PATCH] libCom: Fix use-after-free bug in macCore.c --- src/libCom/macLib/macCore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libCom/macLib/macCore.c b/src/libCom/macLib/macCore.c index 02c8da765..dea4a061b 100644 --- a/src/libCom/macLib/macCore.c +++ b/src/libCom/macLib/macCore.c @@ -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; }