From: dbv Date: Wed, 7 Mar 2012 10:34:51 +0000 (+0400) Subject: 0022954: Variable not freed upon realloc failure X-Git-Tag: V6_5_3_beta1~50 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=8413a813dfda79ca748ad367bec1ffebba9ce652;p=occt.git 0022954: Variable not freed upon realloc failure --- diff --git a/src/OSD/OSD_Environment.cxx b/src/OSD/OSD_Environment.cxx index 6b6ed0f6cc..251e00eed2 100755 --- a/src/OSD/OSD_Environment.cxx +++ b/src/OSD/OSD_Environment.cxx @@ -143,7 +143,17 @@ void OSD_Environment::Build () else { // Allocation memoire. Surtout tout la heap! index = Ibuffer++; - buffer = (char **) realloc ( buffer, Ibuffer * sizeof(char*) ); + char **aTmp; + aTmp = (char **) realloc ( buffer, Ibuffer * sizeof(char*) ); + if (aTmp) + { + buffer = aTmp; + } + else + { + myError.SetValue(errno, Iam, "Memory realloc failure"); + return; + } } // create a new entry in the buffer and add it to environment