From 9dde06de130463c20f8b603ed3a3ffe10347f2f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= Date: Tue, 14 May 2019 14:11:17 -0700 Subject: [PATCH] http-push: prevent format overflow warning with gcc >= 9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In function 'finish_request', inlined from 'process_response' at http-push.c:248:2: http-push.c:587:4: warning: '%s' directive argument is null [-Wformat-overflow=] 587 | fprintf(stderr, "Unable to get pack file %s\n%s", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 588 | request->url, curl_errorstr); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ request->url is needed for the error message if there was a failure during fetch but was being cleared unnecessarily earlier. note that the leak is prevented by calling release_request unconditionally at the end. Signed-off-by: Carlo Marcelo Arenas Belón Suggested-by: Eric Sunshine Signed-off-by: Junio C Hamano --- http-push.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http-push.c b/http-push.c index b22c7caea0..f56cd91d44 100644 --- a/http-push.c +++ b/http-push.c @@ -525,8 +525,8 @@ static void finish_request(struct transfer_request *request) if (request->headers != NULL) curl_slist_free_all(request->headers); - /* URL is reused for MOVE after PUT */ - if (request->state != RUN_PUT) { + /* URL is reused for MOVE after PUT and used during FETCH */ + if (request->state != RUN_PUT && request->state != RUN_FETCH_PACKED) { FREE_AND_NULL(request->url); }