Skip to content
Snippets Groups Projects
Commit 2f70fb70 authored by Gisle Vanem's avatar Gisle Vanem
Browse files

Use ares_free_string() to avoid detecting leaks.

parent 655ec6bf
No related branches found
No related tags found
No related merge requests found
...@@ -396,7 +396,7 @@ static const unsigned char *display_question(const unsigned char *aptr, ...@@ -396,7 +396,7 @@ static const unsigned char *display_question(const unsigned char *aptr,
*/ */
if (aptr + QFIXEDSZ > abuf + alen) if (aptr + QFIXEDSZ > abuf + alen)
{ {
free(name); ares_free_string(name);
return NULL; return NULL;
} }
...@@ -412,7 +412,7 @@ static const unsigned char *display_question(const unsigned char *aptr, ...@@ -412,7 +412,7 @@ static const unsigned char *display_question(const unsigned char *aptr,
if (dnsclass != C_IN) if (dnsclass != C_IN)
printf("\t%s", class_name(dnsclass)); printf("\t%s", class_name(dnsclass));
printf("\t%s\n", type_name(type)); printf("\t%s\n", type_name(type));
free(name); ares_free_string(name);
return aptr; return aptr;
} }
...@@ -436,7 +436,7 @@ static const unsigned char *display_rr(const unsigned char *aptr, ...@@ -436,7 +436,7 @@ static const unsigned char *display_rr(const unsigned char *aptr,
*/ */
if (aptr + RRFIXEDSZ > abuf + alen) if (aptr + RRFIXEDSZ > abuf + alen)
{ {
free(name); ares_free_string(name);
return NULL; return NULL;
} }
...@@ -449,7 +449,7 @@ static const unsigned char *display_rr(const unsigned char *aptr, ...@@ -449,7 +449,7 @@ static const unsigned char *display_rr(const unsigned char *aptr,
aptr += RRFIXEDSZ; aptr += RRFIXEDSZ;
if (aptr + dlen > abuf + alen) if (aptr + dlen > abuf + alen)
{ {
free(name); ares_free_string(name);
return NULL; return NULL;
} }
...@@ -458,7 +458,7 @@ static const unsigned char *display_rr(const unsigned char *aptr, ...@@ -458,7 +458,7 @@ static const unsigned char *display_rr(const unsigned char *aptr,
if (dnsclass != C_IN) if (dnsclass != C_IN)
printf("\t%s", class_name(dnsclass)); printf("\t%s", class_name(dnsclass));
printf("\t%s", type_name(type)); printf("\t%s", type_name(type));
free(name); ares_free_string(name);
/* Display the RR data. Don't touch aptr. */ /* Display the RR data. Don't touch aptr. */
switch (type) switch (type)
...@@ -476,7 +476,7 @@ static const unsigned char *display_rr(const unsigned char *aptr, ...@@ -476,7 +476,7 @@ static const unsigned char *display_rr(const unsigned char *aptr,
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.", name); printf("\t%s.", name);
free(name); ares_free_string(name);
break; break;
case T_HINFO: case T_HINFO:
...@@ -500,13 +500,13 @@ static const unsigned char *display_rr(const unsigned char *aptr, ...@@ -500,13 +500,13 @@ static const unsigned char *display_rr(const unsigned char *aptr,
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.", name); printf("\t%s.", name);
free(name); ares_free_string(name);
p += len; p += len;
status = ares_expand_name(p, abuf, alen, &name, &len); status = ares_expand_name(p, abuf, alen, &name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.", name); printf("\t%s.", name);
free(name); ares_free_string(name);
break; break;
case T_MX: case T_MX:
...@@ -520,7 +520,7 @@ static const unsigned char *display_rr(const unsigned char *aptr, ...@@ -520,7 +520,7 @@ static const unsigned char *display_rr(const unsigned char *aptr,
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.", name); printf("\t%s.", name);
free(name); ares_free_string(name);
break; break;
case T_SOA: case T_SOA:
...@@ -532,13 +532,13 @@ static const unsigned char *display_rr(const unsigned char *aptr, ...@@ -532,13 +532,13 @@ static const unsigned char *display_rr(const unsigned char *aptr,
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.\n", name); printf("\t%s.\n", name);
free(name); ares_free_string(name);
p += len; p += len;
status = ares_expand_name(p, abuf, alen, &name, &len); status = ares_expand_name(p, abuf, alen, &name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t\t\t\t\t\t%s.\n", name); printf("\t\t\t\t\t\t%s.\n", name);
free(name); ares_free_string(name);
p += len; p += len;
if (p + 20 > aptr + dlen) if (p + 20 > aptr + dlen)
return NULL; return NULL;
...@@ -592,7 +592,7 @@ static const unsigned char *display_rr(const unsigned char *aptr, ...@@ -592,7 +592,7 @@ static const unsigned char *display_rr(const unsigned char *aptr,
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.", name); printf("\t%s.", name);
free(name); ares_free_string(name);
break; break;
default: default:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment