summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-15 22:47:03 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-15 22:47:03 -0400
commit4e0296a943e85316ecce0324248f9543887b8a9a (patch)
tree5a31f947817d8bed82c75aded6247cb97e606545
parentda2e1c71662c348d31f0fc39e42963283c550a28 (diff)
resolve: avoid use of uninitalized variable
-rw-r--r--src/resolve/resolved-dns-packet.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index 2a666924b0..a503b01506 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -594,7 +594,7 @@ fail:
}
int dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, size_t *start) {
- _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL;
+ _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr;
size_t saved_rindex, offset;
uint16_t rdlength;
const void *d;
@@ -603,11 +603,11 @@ int dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, size_t *start) {
assert(p);
assert(ret);
- saved_rindex = p->rindex;
-
rr = dns_resource_record_new();
if (!rr)
- goto fail;
+ return -ENOMEM;
+
+ saved_rindex = p->rindex;
r = dns_packet_read_key(p, &rr->key, NULL);
if (r < 0)