Commit 90306774 authored by Mark Andrews's avatar Mark Andrews

query could be tested uninitialised, check the result of dns_message_create

parent e4bca654
......@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: gsstest.c,v 1.16 2011/03/28 05:14:51 marka Exp $ */
/* $Id: gsstest.c,v 1.17 2011/08/29 23:21:48 marka Exp $ */
#include <config.h>
......@@ -146,14 +146,14 @@ recvresponse(isc_task_t *task, isc_event_t *event) {
REQUIRE(reqev != NULL);
query = reqev->ev_arg;
if (reqev->result != ISC_R_SUCCESS) {
fprintf(stderr, "I:request event result: %s\n",
isc_result_totext(reqev->result));
goto end;
}
query = reqev->ev_arg;
response = NULL;
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &response);
CHECK("dns_message_create", result);
......@@ -174,7 +174,7 @@ recvresponse(isc_task_t *task, isc_event_t *event) {
if (response)
dns_message_destroy(&response);
end:
end:
if (query)
dns_message_destroy(&query);
......@@ -220,6 +220,8 @@ sendquery(isc_task_t *task, isc_event_t *event)
CHECK("dns_name_fromtext", result);
result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &message);
if (result != ISC_R_SUCCESS)
goto end;
message->opcode = dns_opcode_query;
message->rdclass = dns_rdataclass_in;
......@@ -256,13 +258,13 @@ sendquery(isc_task_t *task, isc_event_t *event)
return;
end:
if (qname != NULL)
dns_message_puttempname(message, &qname);
if (qrdataset != NULL)
dns_message_puttemprdataset(message, &qrdataset);
if (message != NULL)
dns_message_destroy(&message);
end:
if (qname != NULL)
dns_message_puttempname(message, &qname);
if (qrdataset != NULL)
dns_message_puttemprdataset(message, &qrdataset);
if (message != NULL)
dns_message_destroy(&message);
}
static void
......@@ -280,14 +282,14 @@ initctx2(isc_task_t *task, isc_event_t *event) {
REQUIRE(reqev != NULL);
query = reqev->ev_arg;
if (reqev->result != ISC_R_SUCCESS) {
fprintf(stderr, "I:request event result: %s\n",
isc_result_totext(reqev->result));
goto end;
}
query = reqev->ev_arg;
response = NULL;
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &response);
CHECK("dns_message_create", result);
......@@ -331,7 +333,7 @@ initctx2(isc_task_t *task, isc_event_t *event) {
if (response)
dns_message_destroy(&response);
end:
end:
if (query)
dns_message_destroy(&query);
......@@ -406,7 +408,7 @@ initctx1(isc_task_t *task, isc_event_t *event) {
CHECK("dns_request_create", result);
return;
end:
end:
event = isc_event_allocate(mctx, (void *)1, 1, console, NULL,
sizeof(*event));
isc_task_send(task, &event);return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment