[xml] Action of realloc

Date view Thread view Subject view Author view

From: JohnnyXia@acersoftech.com.cn
Date: Tue Dec 05 2000 - 02:38:54 EST


Hi all,

I think it is a bug of libxml, at least on the windows platform.
This is about the actions of realloc,if realloc fails, would it
free the old memory block? If so, then codes like the following
are right:

char* fun( char* pOld )
{
     pOld = realloc( pOld, newsize );
     if( pOld == NULL )
          return NULL;
     ...
}

If not, then the above codes will cause memory leak when realloc fails.

On windows platform, unfortunately, realloc won't free the old memory
block,
if it fails to alloc a new block.

In libxml, it seems that it assumes realloc would free the old memory block
when realloc fails.

Johnny Xia.

----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Dec 05 2000 - 02:46:18 EST