Various Coverity issues after dns_message_gettemp* cleanup
Various issues identified by Coverity Scan after dns_message_gettemp*
functions cleanup (33ba0057) on main
:
** CID 352819: Control flow issues (DEADCODE)
/lib/dns/xfrin.c: 1366 in xfrin_send_request()
________________________________________________________________________________________________________
*** CID 352819: Control flow issues (DEADCODE)
/lib/dns/xfrin.c: 1366 in xfrin_send_request()
1360
1361 failure:
1362 if (qname != NULL) {
1363 dns_message_puttempname(msg, &qname);
1364 }
1365 if (qrdataset != NULL) {
>>> CID 352819: Control flow issues (DEADCODE)
>>> Execution cannot reach this statement: "dns_message_puttemprdataset...".
1366 dns_message_puttemprdataset(msg, &qrdataset);
1367 }
1368 if (msg != NULL) {
1369 dns_message_detach(&msg);
1370 }
1371 if (soatuple != NULL) {
** CID 352818: Null pointer dereferences (REVERSE_INULL)
/lib/dns/message.c: 2882 in dns_message_setquerytsig()
________________________________________________________________________________________________________
*** CID 352818: Null pointer dereferences (REVERSE_INULL)
/lib/dns/message.c: 2882 in dns_message_setquerytsig()
2876
2877 msg->querytsig = set;
2878
2879 return (result);
2880
2881 cleanup:
>>> CID 352818: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "rdata" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
2882 if (rdata != NULL) {
2883 dns_message_puttemprdata(msg, &rdata);
2884 }
2885 if (list != NULL) {
2886 dns_message_puttemprdatalist(msg, &list);
2887 }
** CID 352817: Control flow issues (DEADCODE)
/lib/ns/xfrout.c: 1568 in sendstream()
________________________________________________________________________________________________________
*** CID 352817: Control flow issues (DEADCODE)
/lib/ns/xfrout.c: 1568 in sendstream()
1562
1563 /* Advance lasttsig to be the last TSIG generated */
1564 CHECK(dns_message_getquerytsig(msg, xfr->mctx, &xfr->lasttsig));
1565
1566 failure:
1567 if (msgname != NULL) {
>>> CID 352817: Control flow issues (DEADCODE)
>>> Execution cannot reach this statement: "if (msgrds != NULL) {
if ...".
1568 if (msgrds != NULL) {
1569 if (dns_rdataset_isassociated(msgrds)) {
1570 dns_rdataset_disassociate(msgrds);
1571 }
1572 dns_message_puttemprdataset(msg, &msgrds);
1573 }
** CID 352816: Control flow issues (DEADCODE)
/lib/ns/query.c: 8443 in query_dns64()
________________________________________________________________________________________________________
*** CID 352816: Control flow issues (DEADCODE)
/lib/ns/query.c: 8443 in query_dns64()
8437 cleanup:
8438 if (buffer != NULL) {
8439 isc_buffer_free(&buffer);
8440 }
8441
8442 if (dns64_rdata != NULL) {
>>> CID 352816: Control flow issues (DEADCODE)
>>> Execution cannot reach this statement: "dns_message_puttemprdata(cl...".
8443 dns_message_puttemprdata(client->message, &dns64_rdata);
8444 }
8445
8446 if (dns64_rdataset != NULL) {
8447 dns_message_puttemprdataset(client->message, &dns64_rdataset);
8448 }
** CID 352815: Control flow issues (DEADCODE)
/lib/dns/xfrin.c: 1363 in xfrin_send_request()
________________________________________________________________________________________________________
*** CID 352815: Control flow issues (DEADCODE)
/lib/dns/xfrin.c: 1363 in xfrin_send_request()
1357 isc_nmhandle_attach(send_xfr->handle, &xfr->sendhandle);
1358 isc_refcount_increment0(&send_xfr->sends);
1359 isc_nm_send(xfr->handle, ®ion, xfrin_send_done, send_xfr);
1360
1361 failure:
1362 if (qname != NULL) {
>>> CID 352815: Control flow issues (DEADCODE)
>>> Execution cannot reach this statement: "dns_message_puttempname(msg...".
1363 dns_message_puttempname(msg, &qname);
1364 }
1365 if (qrdataset != NULL) {
1366 dns_message_puttemprdataset(msg, &qrdataset);
1367 }
1368 if (msg != NULL) {
** CID 352814: Null pointer dereferences (REVERSE_INULL)
/lib/dns/xfrin.c: 1267 in tuple2msgname()
________________________________________________________________________________________________________
*** CID 352814: Null pointer dereferences (REVERSE_INULL)
/lib/dns/xfrin.c: 1267 in tuple2msgname()
1261 failure:
1262
1263 if (rds != NULL) {
1264 dns_rdataset_disassociate(rds);
1265 dns_message_puttemprdataset(msg, &rds);
1266 }
>>> CID 352814: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "rdl" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1267 if (rdl != NULL) {
1268 ISC_LIST_UNLINK(rdl->rdata, rdata, link);
1269 dns_message_puttemprdatalist(msg, &rdl);
1270 }
1271 if (rdata != NULL) {
1272 dns_message_puttemprdata(msg, &rdata);
** CID 352813: Null pointer dereferences (REVERSE_INULL)
/lib/dns/tkey.c: 199 in add_rdata_to_list()
________________________________________________________________________________________________________
*** CID 352813: Null pointer dereferences (REVERSE_INULL)
/lib/dns/tkey.c: 199 in add_rdata_to_list()
193
194 ISC_LIST_APPEND(*namelist, newname, link);
195
196 return (ISC_R_SUCCESS);
197
198 failure:
>>> CID 352813: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "newrdata" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
199 if (newrdata != NULL) {
200 if (ISC_LINK_LINKED(newrdata, link)) {
201 INSIST(newlist != NULL);
202 ISC_LIST_UNLINK(newlist->rdata, newrdata, link);
203 }
204 dns_message_puttemprdata(msg, &newrdata);
** CID 352812: Control flow issues (DEADCODE)
/lib/ns/query.c: 8584 in query_filter64()
________________________________________________________________________________________________________
*** CID 352812: Control flow issues (DEADCODE)
/lib/ns/query.c: 8584 in query_filter64()
8578 cleanup:
8579 if (buffer != NULL) {
8580 isc_buffer_free(&buffer);
8581 }
8582
8583 if (myrdata != NULL) {
>>> CID 352812: Control flow issues (DEADCODE)
>>> Execution cannot reach this statement: "dns_message_puttemprdata(cl...".
8584 dns_message_puttemprdata(client->message, &myrdata);
8585 }
8586
8587 if (myrdataset != NULL) {
8588 dns_message_puttemprdataset(client->message, &myrdataset);
8589 }
** CID 352811: Null pointer dereferences (REVERSE_INULL)
/lib/dns/tkey.c: 213 in add_rdata_to_list()
________________________________________________________________________________________________________
*** CID 352811: Null pointer dereferences (REVERSE_INULL)
/lib/dns/tkey.c: 213 in add_rdata_to_list()
207 dns_message_puttempname(msg, &newname);
208 }
209 if (newset != NULL) {
210 dns_rdataset_disassociate(newset);
211 dns_message_puttemprdataset(msg, &newset);
212 }
>>> CID 352811: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "newlist" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
213 if (newlist != NULL) {
214 dns_message_puttemprdatalist(msg, &newlist);
215 }
216 return (result);
217 }
218
** CID 352810: Null pointer dereferences (REVERSE_INULL)
/lib/dns/message.c: 2885 in dns_message_setquerytsig()
________________________________________________________________________________________________________
*** CID 352810: Null pointer dereferences (REVERSE_INULL)
/lib/dns/message.c: 2885 in dns_message_setquerytsig()
2879 return (result);
2880
2881 cleanup:
2882 if (rdata != NULL) {
2883 dns_message_puttemprdata(msg, &rdata);
2884 }
>>> CID 352810: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "list" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
2885 if (list != NULL) {
2886 dns_message_puttemprdatalist(msg, &list);
2887 }
2888 if (set != NULL) {
2889 dns_message_puttemprdataset(msg, &set);
2890 }
** CID 352809: Null pointer dereferences (REVERSE_INULL)
/lib/dns/message.c: 4654 in dns_message_buildopt()
________________________________________________________________________________________________________
*** CID 352809: Null pointer dereferences (REVERSE_INULL)
/lib/dns/message.c: 4654 in dns_message_buildopt()
4648 if (rdata != NULL) {
4649 dns_message_puttemprdata(message, &rdata);
4650 }
4651 if (rdataset != NULL) {
4652 dns_message_puttemprdataset(message, &rdataset);
4653 }
>>> CID 352809: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "rdatalist" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
4654 if (rdatalist != NULL) {
4655 dns_message_puttemprdatalist(message, &rdatalist);
4656 }
4657 return (result);
4658 }
4659
** CID 352808: Null pointer dereferences (REVERSE_INULL)
/lib/dns/xfrin.c: 1271 in tuple2msgname()
________________________________________________________________________________________________________
*** CID 352808: Null pointer dereferences (REVERSE_INULL)
/lib/dns/xfrin.c: 1271 in tuple2msgname()
1265 dns_message_puttemprdataset(msg, &rds);
1266 }
1267 if (rdl != NULL) {
1268 ISC_LIST_UNLINK(rdl->rdata, rdata, link);
1269 dns_message_puttemprdatalist(msg, &rdl);
1270 }
>>> CID 352808: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "rdata" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1271 if (rdata != NULL) {
1272 dns_message_puttemprdata(msg, &rdata);
1273 }
1274
1275 return (result);
1276 }