From 6735890bae2db0e95abf056e61d332c892cfaf49 Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Sun, 27 Nov 2022 14:31:23 +0000 Subject: Plug leak of tmp in case allocation of pq->abuf fails ok florian --- sbin/unwind/frontend.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sbin/unwind') diff --git a/sbin/unwind/frontend.c b/sbin/unwind/frontend.c index c241a6c82e9..e7578852ea3 100644 --- a/sbin/unwind/frontend.c +++ b/sbin/unwind/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.75 2022/11/27 14:29:06 tb Exp $ */ +/* $OpenBSD: frontend.c,v 1.76 2022/11/27 14:31:22 tb Exp $ */ /* * Copyright (c) 2018 Florian Obser @@ -1707,10 +1707,13 @@ tcp_request(int fd, short events, void *arg) sldns_buffer_flip(pq->qbuf); len = sldns_buffer_read_u16(pq->qbuf); tmp = sldns_buffer_new(len); + if (tmp == NULL) + goto fail; pq->abuf = sldns_buffer_new(len); - - if (!tmp || !pq->abuf) + if (pq->abuf == NULL) { + sldns_buffer_free(tmp); goto fail; + } rem = sldns_buffer_remaining(pq->qbuf); sldns_buffer_write(tmp, sldns_buffer_current(pq->qbuf), -- cgit v1.2.3