git: b212f565fb1a - main - libfetch: Plug leak in 304 Not Modified case

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Wed, 30 Sep 2026 16:55:49 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=b212f565fb1a34fdcd2f5c9530164ff4718a1a9f

commit b212f565fb1a34fdcd2f5c9530164ff4718a1a9f
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-09-30 16:55:18 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-09-30 16:55:18 +0000

    libfetch: Plug leak in 304 Not Modified case
    
    When we get a 304 Not Modified response, we need to go through the error
    path to properly free any resources we've allocated instead of just
    returning NULL directly.
    
    MFC after:      1 week
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D60016
---
 lib/libfetch/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c
index c5415b875155..8fe98c57446d 100644
--- a/lib/libfetch/http.c
+++ b/lib/libfetch/http.c
@@ -1986,7 +1986,7 @@ http_request_body(struct url *URL, const char *op, struct url_stat *us,
 
 	if (conn->err == HTTP_NOT_MODIFIED) {
 		http_seterr(HTTP_NOT_MODIFIED);
-		return (NULL);
+		goto ouch;
 	}
 
 	/* check for inconsistencies */