Subject: [PATCH] Fix memleak

[PATCH] Fix memleak

From: Tom Hughes <tom.hughes_at_palm.com>
Date: Wed, 27 Jul 2011 14:18:34 -0700
When running the node.js unit tests under valgrind, I came across a memory leak that appears to occur in an edge case:

http://my.cdash.org/viewDynamicAnalysis.php?buildid=213364

http://my.cdash.org/viewDynamicAnalysisFile.php?id=698624

The attached patch fixes the issue, but I don't know enough about c-ares to know if this is truly the "right" fix.

It looks like this boils down to a call in node to ares_gethostbyname with ipv6.google.com as the name and AF_INET as the family (If a family isn't specified to node when attempting to do a lookup, it defaults to trying IPv4 first. If there are no addresses returned it then tries IPv6).

You can reproduce with:

valgrind --leak-check=full ./build/default/node ./test/simple/test-c-ares.js

Tom



Received on 2011-07-28