Subject: Problem on free() method on Windows 7

Problem on free() method on Windows 7

From: <aur.hoffmann_at_free.fr>
Date: Wed, 13 Feb 2013 10:48:55 +0100

Hello all,

I use c-ares 1.9.1 library in a program compiled with Visual C++ 6.0.
When I run the program on Windows XP, it's OK.
But, when I run the program on Windows 7, I have an error : "the program has
stopped working"...

By adding traces in my program, I noticed that the problem was on free() method.

For example:
_____________________________________________________________________
char *hostname = NULL;
...
int status = ares_expand_name (aptr, abuf, alen, &hostname, &len);
if (status != ARES_SUCCESS)
  return status;

if (hostname)
  free (hostname); <==> ERROR <==>
_____________________________________________________________________

Before doing free() on hostname, hostname is allocated in ares_expand_name()
method.
When I do a printf of "hostname" before calling free() method, hostname is OK,
it contain the good value.

Does someone has already encountered that problem ?
Or does someone has a solution to that problem ?

Thanks in advance,
Regards
Received on 2013-02-13