Commit bd7dcde3 authored by Daniel Salzman's avatar Daniel Salzman

pkt: remove useless pointer sanitization in knot_pkt_free

parent 8f601ef8
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -224,7 +224,7 @@ static int remote_forward(conf_t *conf, struct knot_request *request, conf_remot ...@@ -224,7 +224,7 @@ static int remote_forward(conf_t *conf, struct knot_request *request, conf_remot
knot_pkt_t *query = knot_pkt_new(NULL, request->query->max_size, NULL); knot_pkt_t *query = knot_pkt_new(NULL, request->query->max_size, NULL);
int ret = knot_pkt_copy(query, request->query); int ret = knot_pkt_copy(query, request->query);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_pkt_free(&query); knot_pkt_free(query);
return ret; return ret;
} }
knot_wire_set_id(query->wire, dnssec_random_uint16_t()); knot_wire_set_id(query->wire, dnssec_random_uint16_t());
...@@ -240,7 +240,7 @@ static int remote_forward(conf_t *conf, struct knot_request *request, conf_remot ...@@ -240,7 +240,7 @@ static int remote_forward(conf_t *conf, struct knot_request *request, conf_remot
struct knot_requestor re; struct knot_requestor re;
ret = knot_requestor_init(&re, capture, &capture_param, NULL); ret = knot_requestor_init(&re, capture, &capture_param, NULL);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_pkt_free(&query); knot_pkt_free(query);
return ret; return ret;
} }
...@@ -250,7 +250,7 @@ static int remote_forward(conf_t *conf, struct knot_request *request, conf_remot ...@@ -250,7 +250,7 @@ static int remote_forward(conf_t *conf, struct knot_request *request, conf_remot
struct knot_request *req = knot_request_make(re.mm, dst, src, query, NULL, 0); struct knot_request *req = knot_request_make(re.mm, dst, src, query, NULL, 0);
if (req == NULL) { if (req == NULL) {
knot_requestor_clear(&re); knot_requestor_clear(&re);
knot_pkt_free(&query); knot_pkt_free(query);
return KNOT_ENOMEM; return KNOT_ENOMEM;
} }
...@@ -356,8 +356,8 @@ static void send_update_response(conf_t *conf, const zone_t *zone, struct knot_r ...@@ -356,8 +356,8 @@ static void send_update_response(conf_t *conf, const zone_t *zone, struct knot_r
static void free_request(struct knot_request *req) static void free_request(struct knot_request *req)
{ {
close(req->fd); close(req->fd);
knot_pkt_free(&req->query); knot_pkt_free(req->query);
knot_pkt_free(&req->resp); knot_pkt_free(req->resp);
free(req); free(req);
} }
......
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -156,8 +156,8 @@ void knot_request_free(struct knot_request *request, knot_mm_t *mm) ...@@ -156,8 +156,8 @@ void knot_request_free(struct knot_request *request, knot_mm_t *mm)
if (request->fd >= 0) { if (request->fd >= 0) {
close(request->fd); close(request->fd);
} }
knot_pkt_free(&request->query); knot_pkt_free(request->query);
knot_pkt_free(&request->resp); knot_pkt_free(request->resp);
tsig_cleanup(&request->tsig); tsig_cleanup(&request->tsig);
mm_free(mm, request); mm_free(mm, request);
......
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -168,8 +168,8 @@ static int tcp_handle(tcp_context_t *tcp, int fd, ...@@ -168,8 +168,8 @@ static int tcp_handle(tcp_context_t *tcp, int fd,
knot_layer_finish(&tcp->layer); knot_layer_finish(&tcp->layer);
/* Cleanup. */ /* Cleanup. */
knot_pkt_free(&query); knot_pkt_free(query);
knot_pkt_free(&ans); knot_pkt_free(ans);
return ret; return ret;
} }
......
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -100,8 +100,8 @@ static void udp_handle(udp_context_t *udp, int fd, struct sockaddr_storage *ss, ...@@ -100,8 +100,8 @@ static void udp_handle(udp_context_t *udp, int fd, struct sockaddr_storage *ss,
knot_layer_finish(&udp->layer); knot_layer_finish(&udp->layer);
/* Cleanup. */ /* Cleanup. */
knot_pkt_free(&query); knot_pkt_free(query);
knot_pkt_free(&ans); knot_pkt_free(ans);
} }
/*! \brief Pointer to selected UDP master implementation. */ /*! \brief Pointer to selected UDP master implementation. */
......
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -555,7 +555,7 @@ int zone_update_enqueue(zone_t *zone, knot_pkt_t *pkt, knotd_qdata_params_t *par ...@@ -555,7 +555,7 @@ int zone_update_enqueue(zone_t *zone, knot_pkt_t *pkt, knotd_qdata_params_t *par
req->query = knot_pkt_new(NULL, pkt->max_size, NULL); req->query = knot_pkt_new(NULL, pkt->max_size, NULL);
int ret = knot_pkt_copy(req->query, pkt); int ret = knot_pkt_copy(req->query, pkt);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_pkt_free(&req->query); knot_pkt_free(req->query);
free(req); free(req);
return ret; return ret;
} }
......
...@@ -378,26 +378,25 @@ void knot_pkt_clear(knot_pkt_t *pkt) ...@@ -378,26 +378,25 @@ void knot_pkt_clear(knot_pkt_t *pkt)
} }
_public_ _public_
void knot_pkt_free(knot_pkt_t **pkt) void knot_pkt_free(knot_pkt_t *pkt)
{ {
if (pkt == NULL || *pkt == NULL) { if (pkt == NULL) {
return; return;
} }
/* Free temporary RRSets. */ /* Free temporary RRSets. */
pkt_free_data(*pkt); pkt_free_data(pkt);
/* Free RR/RR info arrays. */ /* Free RR/RR info arrays. */
mm_free(&(*pkt)->mm, (*pkt)->rr); mm_free(&pkt->mm, pkt->rr);
mm_free(&(*pkt)->mm, (*pkt)->rr_info); mm_free(&pkt->mm, pkt->rr_info);
// free the space for wireformat // free the space for wireformat
if ((*pkt)->flags & KNOT_PF_FREE) { if (pkt->flags & KNOT_PF_FREE) {
mm_free(&(*pkt)->mm, (*pkt)->wire); mm_free(&pkt->mm, pkt->wire);
} }
mm_free(&(*pkt)->mm, *pkt); mm_free(&pkt->mm, pkt);
*pkt = NULL;
} }
_public_ _public_
......
...@@ -139,7 +139,7 @@ int knot_pkt_init_response(knot_pkt_t *pkt, const knot_pkt_t *query); ...@@ -139,7 +139,7 @@ int knot_pkt_init_response(knot_pkt_t *pkt, const knot_pkt_t *query);
void knot_pkt_clear(knot_pkt_t *pkt); void knot_pkt_clear(knot_pkt_t *pkt);
/*! \brief Begone you foul creature of the underworld. */ /*! \brief Begone you foul creature of the underworld. */
void knot_pkt_free(knot_pkt_t **pkt); void knot_pkt_free(knot_pkt_t *pkt);
/*! /*!
* \brief Reserve an arbitrary amount of space in the packet. * \brief Reserve an arbitrary amount of space in the packet.
......
...@@ -235,7 +235,7 @@ static void process_dnstap(const query_t *query) ...@@ -235,7 +235,7 @@ static void process_dnstap(const query_t *query)
ERR("can't print dnstap message\n"); ERR("can't print dnstap message\n");
} }
knot_pkt_free(&pkt); knot_pkt_free(pkt);
dt_reader_free_frame(reader, &frame); dt_reader_free_frame(reader, &frame);
} }
} }
...@@ -412,7 +412,7 @@ static knot_pkt_t *create_query_packet(const query_t *query) ...@@ -412,7 +412,7 @@ static knot_pkt_t *create_query_packet(const query_t *query)
// Create QNAME from string. // Create QNAME from string.
knot_dname_t *qname = knot_dname_from_str_alloc(query->owner); knot_dname_t *qname = knot_dname_from_str_alloc(query->owner);
if (qname == NULL) { if (qname == NULL) {
knot_pkt_free(&packet); knot_pkt_free(packet);
return NULL; return NULL;
} }
...@@ -421,7 +421,7 @@ static knot_pkt_t *create_query_packet(const query_t *query) ...@@ -421,7 +421,7 @@ static knot_pkt_t *create_query_packet(const query_t *query)
query->type_num); query->type_num);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_dname_free(&qname, NULL); knot_dname_free(&qname, NULL);
knot_pkt_free(&packet); knot_pkt_free(packet);
return NULL; return NULL;
} }
...@@ -444,7 +444,7 @@ static knot_pkt_t *create_query_packet(const query_t *query) ...@@ -444,7 +444,7 @@ static knot_pkt_t *create_query_packet(const query_t *query)
&packet->mm); &packet->mm);
knot_dname_free(&qname, NULL); knot_dname_free(&qname, NULL);
if (soa == NULL) { if (soa == NULL) {
knot_pkt_free(&packet); knot_pkt_free(packet);
return NULL; return NULL;
} }
...@@ -452,7 +452,7 @@ static knot_pkt_t *create_query_packet(const query_t *query) ...@@ -452,7 +452,7 @@ static knot_pkt_t *create_query_packet(const query_t *query)
ret = knot_rrset_add_rdata(soa, wire, sizeof(wire), &packet->mm); ret = knot_rrset_add_rdata(soa, wire, sizeof(wire), &packet->mm);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_rrset_free(&soa, &packet->mm); knot_rrset_free(&soa, &packet->mm);
knot_pkt_free(&packet); knot_pkt_free(packet);
return NULL; return NULL;
} }
...@@ -462,7 +462,7 @@ static knot_pkt_t *create_query_packet(const query_t *query) ...@@ -462,7 +462,7 @@ static knot_pkt_t *create_query_packet(const query_t *query)
ret = knot_pkt_put(packet, KNOT_COMPR_HINT_NONE, soa, KNOT_PF_FREE); ret = knot_pkt_put(packet, KNOT_COMPR_HINT_NONE, soa, KNOT_PF_FREE);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_rrset_free(&soa, &packet->mm); knot_rrset_free(&soa, &packet->mm);
knot_pkt_free(&packet); knot_pkt_free(packet);
return NULL; return NULL;
} }
...@@ -479,7 +479,7 @@ static knot_pkt_t *create_query_packet(const query_t *query) ...@@ -479,7 +479,7 @@ static knot_pkt_t *create_query_packet(const query_t *query)
int ret = add_query_edns(packet, query, max_size); int ret = add_query_edns(packet, query, max_size);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
ERR("can't set up EDNS section\n"); ERR("can't set up EDNS section\n");
knot_pkt_free(&packet); knot_pkt_free(packet);
return NULL; return NULL;
} }
} }
...@@ -636,7 +636,7 @@ static int process_query_packet(const knot_pkt_t *query, ...@@ -636,7 +636,7 @@ static int process_query_packet(const knot_pkt_t *query,
} else { } else {
ERR("can't print query packet\n"); ERR("can't print query packet\n");
} }
knot_pkt_free(&q); knot_pkt_free(q);
} else { } else {
ERR("can't print query packet\n"); ERR("can't print query packet\n");
} }
...@@ -675,7 +675,7 @@ static int process_query_packet(const knot_pkt_t *query, ...@@ -675,7 +675,7 @@ static int process_query_packet(const knot_pkt_t *query,
// Parse reply to the packet structure. // Parse reply to the packet structure.
if (knot_pkt_parse(reply, KNOT_PF_NOCANON) != KNOT_EOK) { if (knot_pkt_parse(reply, KNOT_PF_NOCANON) != KNOT_EOK) {
ERR("malformed reply packet from %s\n", net->remote_str); ERR("malformed reply packet from %s\n", net->remote_str);
knot_pkt_free(&reply); knot_pkt_free(reply);
net_close(net); net_close(net);
return 0; return 0;
} }
...@@ -685,12 +685,12 @@ static int process_query_packet(const knot_pkt_t *query, ...@@ -685,12 +685,12 @@ static int process_query_packet(const knot_pkt_t *query,
break; break;
// Check for timeout. // Check for timeout.
} else if (time_diff_ms(&t_query, &t_end) > 1000 * net->wait) { } else if (time_diff_ms(&t_query, &t_end) > 1000 * net->wait) {
knot_pkt_free(&reply); knot_pkt_free(reply);
net_close(net); net_close(net);
return -1; return -1;
} }
knot_pkt_free(&reply); knot_pkt_free(reply);
} }
// Check for TC bit and repeat query with TCP if required. // Check for TC bit and repeat query with TCP if required.
...@@ -699,7 +699,7 @@ static int process_query_packet(const knot_pkt_t *query, ...@@ -699,7 +699,7 @@ static int process_query_packet(const knot_pkt_t *query,
printf("\n"); printf("\n");
WARN("truncated reply from %s, retrying over TCP\n\n", WARN("truncated reply from %s, retrying over TCP\n\n",
net->remote_str); net->remote_str);
knot_pkt_free(&reply); knot_pkt_free(reply);
net_close(net); net_close(net);
net->socktype = SOCK_STREAM; net->socktype = SOCK_STREAM;
...@@ -740,7 +740,7 @@ static int process_query_packet(const knot_pkt_t *query, ...@@ -740,7 +740,7 @@ static int process_query_packet(const knot_pkt_t *query,
uint8_t *opt = knot_edns_get_option(reply->opt_rr, KNOT_EDNS_OPTION_COOKIE); uint8_t *opt = knot_edns_get_option(reply->opt_rr, KNOT_EDNS_OPTION_COOKIE);
if (opt == NULL) { if (opt == NULL) {
ERR("bad cookie, missing EDNS section\n"); ERR("bad cookie, missing EDNS section\n");
knot_pkt_free(&reply); knot_pkt_free(reply);
return -1; return -1;
} }
...@@ -749,11 +749,11 @@ static int process_query_packet(const knot_pkt_t *query, ...@@ -749,11 +749,11 @@ static int process_query_packet(const knot_pkt_t *query,
int ret = knot_edns_cookie_parse(&new_ctx.cc, &new_ctx.sc, int ret = knot_edns_cookie_parse(&new_ctx.cc, &new_ctx.sc,
data, data_len); data, data_len);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_pkt_free(&reply); knot_pkt_free(reply);
ERR("bad cookie, missing EDNS cookie option\n"); ERR("bad cookie, missing EDNS cookie option\n");
return -1; return -1;
} }
knot_pkt_free(&reply); knot_pkt_free(reply);
// Restore the original client cookie. // Restore the original client cookie.
new_ctx.cc = query_ctx->cc; new_ctx.cc = query_ctx->cc;
...@@ -761,12 +761,12 @@ static int process_query_packet(const knot_pkt_t *query, ...@@ -761,12 +761,12 @@ static int process_query_packet(const knot_pkt_t *query,
knot_pkt_t *new_query = create_query_packet(&new_ctx); knot_pkt_t *new_query = create_query_packet(&new_ctx);
ret = process_query_packet(new_query, net, &new_ctx, ignore_tc, ret = process_query_packet(new_query, net, &new_ctx, ignore_tc,
sign_ctx, style); sign_ctx, style);
knot_pkt_free(&new_query); knot_pkt_free(new_query);
return ret; return ret;
} }
knot_pkt_free(&reply); knot_pkt_free(reply);
net_close(net); net_close(net);
return 0; return 0;
...@@ -846,7 +846,7 @@ static void process_query(const query_t *query) ...@@ -846,7 +846,7 @@ static void process_query(const query_t *query)
if (ret == 0) { if (ret == 0) {
net_clean(&net); net_clean(&net);
sign_context_deinit(&sign_ctx); sign_context_deinit(&sign_ctx);
knot_pkt_free(&out_packet); knot_pkt_free(out_packet);
return; return;
} }
...@@ -870,7 +870,7 @@ static void process_query(const query_t *query) ...@@ -870,7 +870,7 @@ static void process_query(const query_t *query)
} }
sign_context_deinit(&sign_ctx); sign_context_deinit(&sign_ctx);
knot_pkt_free(&out_packet); knot_pkt_free(out_packet);
} }
static int process_xfr_packet(const knot_pkt_t *query, static int process_xfr_packet(const knot_pkt_t *query,
...@@ -930,7 +930,7 @@ static int process_xfr_packet(const knot_pkt_t *query, ...@@ -930,7 +930,7 @@ static int process_xfr_packet(const knot_pkt_t *query,
} else { } else {
ERR("can't print query packet\n"); ERR("can't print query packet\n");
} }
knot_pkt_free(&q); knot_pkt_free(q);
} else { } else {
ERR("can't print query packet\n"); ERR("can't print query packet\n");
} }
...@@ -969,7 +969,7 @@ static int process_xfr_packet(const knot_pkt_t *query, ...@@ -969,7 +969,7 @@ static int process_xfr_packet(const knot_pkt_t *query,
// Parse reply to the packet structure. // Parse reply to the packet structure.
if (knot_pkt_parse(reply, 0) != KNOT_EOK) { if (knot_pkt_parse(reply, 0) != KNOT_EOK) {
ERR("malformed reply packet from %s\n", net->remote_str); ERR("malformed reply packet from %s\n", net->remote_str);
knot_pkt_free(&reply); knot_pkt_free(reply);
net_close(net); net_close(net);
return 0; return 0;
} }
...@@ -977,7 +977,7 @@ static int process_xfr_packet(const knot_pkt_t *query, ...@@ -977,7 +977,7 @@ static int process_xfr_packet(const knot_pkt_t *query,
// Compare reply header id. // Compare reply header id.
if (check_reply_id(reply, query) == false) { if (check_reply_id(reply, query) == false) {
ERR("reply ID mismatch from %s\n", net->remote_str); ERR("reply ID mismatch from %s\n", net->remote_str);
knot_pkt_free(&reply); knot_pkt_free(reply);
net_close(net); net_close(net);
return 0; return 0;
} }
...@@ -991,7 +991,7 @@ static int process_xfr_packet(const knot_pkt_t *query, ...@@ -991,7 +991,7 @@ static int process_xfr_packet(const knot_pkt_t *query,
if (knot_pkt_ext_rcode(reply) != KNOT_RCODE_NOERROR) { if (knot_pkt_ext_rcode(reply) != KNOT_RCODE_NOERROR) {
ERR("server replied with error '%s'\n", ERR("server replied with error '%s'\n",
knot_pkt_ext_rcode_name(reply)); knot_pkt_ext_rcode_name(reply));
knot_pkt_free(&reply); knot_pkt_free(reply);
net_close(net); net_close(net);
return 0; return 0;
} }
...@@ -1011,7 +1011,7 @@ static int process_xfr_packet(const knot_pkt_t *query, ...@@ -1011,7 +1011,7 @@ static int process_xfr_packet(const knot_pkt_t *query,
ERR("reply verification for %s (%s)\n", ERR("reply verification for %s (%s)\n",
net->remote_str, knot_strerror(ret)); net->remote_str, knot_strerror(ret));
knot_pkt_free(&reply); knot_pkt_free(reply);
net_close(net); net_close(net);
return 0; return 0;
} }
...@@ -1023,7 +1023,7 @@ static int process_xfr_packet(const knot_pkt_t *query, ...@@ -1023,7 +1023,7 @@ static int process_xfr_packet(const knot_pkt_t *query,
if (serial < 0) { if (serial < 0) {
ERR("first answer record from %s isn't SOA\n", ERR("first answer record from %s isn't SOA\n",
net->remote_str); net->remote_str);
knot_pkt_free(&reply); knot_pkt_free(reply);
net_close(net); net_close(net);
return 0; return 0;
} }
...@@ -1044,11 +1044,11 @@ static int process_xfr_packet(const knot_pkt_t *query, ...@@ -1044,11 +1044,11 @@ static int process_xfr_packet(const knot_pkt_t *query,
// Check for finished transfer. // Check for finished transfer.
if (finished_xfr(serial, reply, msg_count, query_ctx->serial != -1)) { if (finished_xfr(serial, reply, msg_count, query_ctx->serial != -1)) {
knot_pkt_free(&reply); knot_pkt_free(reply);
break; break;
} }
knot_pkt_free(&reply); knot_pkt_free(reply);
} }
// Get stop reply time. // Get stop reply time.
...@@ -1107,7 +1107,7 @@ static void process_xfr(const query_t *query) ...@@ -1107,7 +1107,7 @@ static void process_xfr(const query_t *query)
flags, &query->tls, &net); flags, &query->tls, &net);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
sign_context_deinit(&sign_ctx); sign_context_deinit(&sign_ctx);
knot_pkt_free(&out_packet); knot_pkt_free(out_packet);
return; return;
} }
...@@ -1133,7 +1133,7 @@ static void process_xfr(const query_t *query) ...@@ -1133,7 +1133,7 @@ static void process_xfr(const query_t *query)
net_clean(&net); net_clean(&net);
sign_context_deinit(&sign_ctx); sign_context_deinit(&sign_ctx);
knot_pkt_free(&out_packet); knot_pkt_free(out_packet);
} }
int kdig_exec(const kdig_params_t *params) int kdig_exec(const kdig_params_t *params)
......
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -146,8 +146,8 @@ void knsupdate_clean(knsupdate_params_t *params) ...@@ -146,8 +146,8 @@ void knsupdate_clean(knsupdate_params_t *params)
srv_info_free(params->srcif); srv_info_free(params->srcif);
free(params->zone); free(params->zone);
zs_deinit(&params->parser); zs_deinit(&params->parser);
knot_pkt_free(&params->query); knot_pkt_free(params->query);
knot_pkt_free(&params->answer); knot_pkt_free(params->answer);
knot_tsig_key_deinit(&params->tsig_key); knot_tsig_key_deinit(&params->tsig_key);
/* Clean up the structure. */ /* Clean up the structure. */
......
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -27,7 +27,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) ...@@ -27,7 +27,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
knot_pkt_t *pkt = knot_pkt_new(copy, size, NULL); knot_pkt_t *pkt = knot_pkt_new(copy, size, NULL);
assert(pkt); assert(pkt);
knot_pkt_parse(pkt, 0); knot_pkt_parse(pkt, 0);
knot_pkt_free(&pkt); knot_pkt_free(pkt);
return 0; return 0;
} }
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -188,10 +188,9 @@ int main(int argc, char *argv[]) ...@@ -188,10 +188,9 @@ int main(int argc, char *argv[])
packet_match(in, copy); packet_match(in, copy);
/* Free packets. */ /* Free packets. */
knot_pkt_free(&copy); knot_pkt_free(copy);
knot_pkt_free(&out); knot_pkt_free(out);
knot_pkt_free(&in); knot_pkt_free(in);
ok(in == NULL && out == NULL && copy == NULL, "pkt: free");
/* Free extra data. */ /* Free extra data. */
for (unsigned i = 0; i < NAMECOUNT; ++i) { for (unsigned i = 0; i < NAMECOUNT; ++i) {
......
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -104,7 +104,7 @@ int main(int argc, char *argv[]) ...@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
int ret = knot_pkt_put_question(query, qname, KNOT_CLASS_IN, KNOT_RRTYPE_A); int ret = knot_pkt_put_question(query, qname, KNOT_CLASS_IN, KNOT_RRTYPE_A);
knot_dname_free(&qname, NULL); knot_dname_free(&qname, NULL);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_pkt_free(&query); knot_pkt_free(query);
return KNOT_ERROR; /* Fatal */ return KNOT_ERROR; /* Fatal */
} }
...@@ -160,7 +160,7 @@ int main(int argc, char *argv[]) ...@@ -160,7 +160,7 @@ int main(int argc, char *argv[])
#endif #endif
knot_dname_free(&zone, NULL); knot_dname_free(&zone, NULL);
knot_pkt_free(&query); knot_pkt_free(query);
rrl_destroy(rrl); rrl_destroy(rrl);
dnssec_crypto_cleanup(); dnssec_crypto_cleanup();
return 0; return 0;
......
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -68,7 +68,7 @@ static void exec_query(knot_layer_t *layer, const char *name, ...@@ -68,7 +68,7 @@ static void exec_query(knot_layer_t *layer, const char *name,
/* Check answer. */ /* Check answer. */
answer_sanity_check(query->wire, answer->wire, answer->size, expected_rcode, name); answer_sanity_check(query->wire, answer->wire, answer->size, expected_rcode, name);
knot_pkt_free(&answer); knot_pkt_free(answer);
} }
/* \internal Helpers */ /* \internal Helpers */
......
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