summaryrefslogtreecommitdiff
path: root/ares_parse_ns_reply.c
diff options
context:
space:
mode:
authorYu Jiung <jiung.yu@samsung.com>2016-11-10 07:24:08 (GMT)
committerYu Jiung <jiung.yu@samsung.com>2016-11-10 07:25:02 (GMT)
commit8166b0204b6945a4fdb89bbae0b0b7168a7cf6e8 (patch)
tree81f0750d91aa467df3ee81cf30d22a65db2e6685 /ares_parse_ns_reply.c
parentccccebb78520ec3a26a18370936516b12ae5d53a (diff)
parent45e88a8337839e5fd88519bc55467053d521c9f6 (diff)
downloadc-ares-8166b0204b6945a4fdb89bbae0b0b7168a7cf6e8.zip
c-ares-8166b0204b6945a4fdb89bbae0b0b7168a7cf6e8.tar.gz
c-ares-8166b0204b6945a4fdb89bbae0b0b7168a7cf6e8.tar.bz2
Conflicts: packaging/c-ares.spec Change-Id: I1ec10e394aed3ef19ee21fefbe3aba7d7a615c74
Diffstat (limited to 'ares_parse_ns_reply.c')
-rw-r--r--ares_parse_ns_reply.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/ares_parse_ns_reply.c b/ares_parse_ns_reply.c
index d331e67..7bb5142 100644
--- a/ares_parse_ns_reply.c
+++ b/ares_parse_ns_reply.c
@@ -73,16 +73,16 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen,
return status;
if ( aptr + len + QFIXEDSZ > abuf + alen )
{
- free( hostname );
+ ares_free( hostname );
return ARES_EBADRESP;
}
aptr += len + QFIXEDSZ;
/* Allocate nameservers array; ancount gives an upper bound */
- nameservers = malloc( ( ancount + 1 ) * sizeof( char * ) );
+ nameservers = ares_malloc( ( ancount + 1 ) * sizeof( char * ) );
if ( !nameservers )
{
- free( hostname );
+ ares_free( hostname );
return ARES_ENOMEM;
}
nameservers_num = 0;
@@ -98,7 +98,7 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen,
if ( aptr + RRFIXEDSZ > abuf + alen )
{
status = ARES_EBADRESP;
- free(rr_name);
+ ares_free(rr_name);
break;
}
rr_type = DNS_RR_TYPE( aptr );
@@ -107,7 +107,7 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen,
aptr += RRFIXEDSZ;
if (aptr + rr_len > abuf + alen)
{
- free(rr_name);
+ ares_free(rr_name);
status = ARES_EBADRESP;
break;
}
@@ -119,33 +119,33 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen,
&len);
if ( status != ARES_SUCCESS )
{
- free(rr_name);
+ ares_free(rr_name);
break;
}
- nameservers[nameservers_num] = malloc(strlen(rr_data)+1);
+ nameservers[nameservers_num] = ares_malloc(strlen(rr_data)+1);
if (nameservers[nameservers_num]==NULL)
{
- free(rr_name);
- free(rr_data);
+ ares_free(rr_name);
+ ares_free(rr_data);
status=ARES_ENOMEM;
break;
}
strcpy(nameservers[nameservers_num],rr_data);
- free(rr_data);
+ ares_free(rr_data);
nameservers_num++;
}
- free( rr_name );
+ ares_free( rr_name );
aptr += rr_len;
if ( aptr > abuf + alen )
- {
+ { /* LCOV_EXCL_START: already checked above */
status = ARES_EBADRESP;
break;
- }
+ } /* LCOV_EXCL_STOP */
}
if ( status == ARES_SUCCESS && nameservers_num == 0 )
@@ -156,10 +156,10 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen,
{
/* We got our answer. Allocate memory to build the host entry. */
nameservers[nameservers_num] = NULL;
- hostent = malloc( sizeof( struct hostent ) );
+ hostent = ares_malloc( sizeof( struct hostent ) );
if ( hostent )
{
- hostent->h_addr_list = malloc( 1 * sizeof( char * ) );
+ hostent->h_addr_list = ares_malloc( 1 * sizeof( char * ) );
if ( hostent->h_addr_list )
{
/* Fill in the hostent and return successfully. */
@@ -171,13 +171,13 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen,
*host = hostent;
return ARES_SUCCESS;
}
- free( hostent );
+ ares_free( hostent );
}
status = ARES_ENOMEM;
}
for ( i = 0; i < nameservers_num; i++ )
- free( nameservers[i] );
- free( nameservers );
- free( hostname );
+ ares_free( nameservers[i] );
+ ares_free( nameservers );
+ ares_free( hostname );
return status;
}