From: tb Date: Sun, 27 Nov 2022 14:31:22 +0000 (+0000) Subject: Plug leak of tmp in case allocation of pq->abuf fails X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b9be5719d6a3232e7169f20b08b28d83d188cb60;p=openbsd Plug leak of tmp in case allocation of pq->abuf fails ok florian --- 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),