Commit Graph

14 Commits

Author SHA1 Message Date
David Drysdale f1bcfa1122 api: Allow injection of user-specified malloc/free functions
Add a new ares_library_init_mem() initialization function for the
library which allows the library user to specify their own malloc,
realloc & free equivalents for use library-wide.

Store these function pointers in library-wide global variables,
defaulting to libc's malloc(), realloc() and free().

Change all calls to malloc, realloc and free to use the function pointer
instead.  Also ensure that ares_strdup() is always available
(even if the local environment includes strdup(3)), and change the
library code to always use it.

Convert calls to calloc() to use ares_malloc() + memset
2016-02-02 10:05:07 +00:00
David Drysdale 87ff25049c Mark unhittable lines
Add comments for the benefit of the lcov tool, marking
lines that cannot be hit.  Typically these are fall-back
protection arms that are already covered by earlier checks,
and so it's not worth taking out the unhittable code (in case
someone changes the code between the two places in future).
2016-02-02 10:05:07 +00:00
Patrick Valsecchi 148c8e0353 protocol parsing: check input data stricter
... so that bad length fields aren't blindly accepted

Bug: http://c-ares.haxx.se/mail/c-ares-archive-2013-04/0016.shtml
2013-04-15 22:28:01 +02:00
Yang Tse 0c677f578e setup_once.h: refactor inclusion of <unistd.h> and <sys/socket.h>
Inclusion of these two header files now done in setup_once.h
2012-12-14 18:36:59 +01:00
Yang Tse a1035276c1 Header inclusion clean-up
Remove header inclusions already done in setup_once.h
2012-12-14 18:25:56 +01:00
Jakub Hrozek 978a929b40 Do not leak rr_name on failures inside ares_parse_ns_reply 2011-06-14 16:41:29 +02:00
Daniel Stenberg a268ae6a78 ares_parse_ns_reply.c: remove CVSism 2011-04-30 00:17:03 +02:00
Yang Tse a82a8fbf82 Renamed c-ares setup.h to ares_setup.h 2009-11-02 11:55:53 +00:00
Yang Tse 80d7a970f1 Add CVS Id tag.
Fix identation of some license lines.
2009-10-30 18:03:57 +00:00
Daniel Stenberg 8362245c42 - Phil Blundell added the internal function ares__expand_name_for_response()
that is now used by the ares_parse_*_reply() functions instead of the
  ares_expand_name() simply to easier return ARES_EBADRESP for the cases where
  the name expansion fails as in responses that really isn't expected.
2009-01-11 13:49:13 +00:00
Yang Tse f214b583f5 adjust inclusion of "nameser.h" 2008-09-17 01:02:57 +00:00
Yang Tse f2582d6949 include header file only when available 2008-09-15 17:14:29 +00:00
Gisle Vanem a627160041 Removed inclusion of <sys/types.h> in .c-files
since it's already included through "setup.h".
2007-02-26 04:33:19 +00:00
Daniel Stenberg c1bc4c19be Vlad Dinulescu added ares_parse_ns_reply() 2007-02-19 14:06:11 +00:00