Skip to content

Commit 9dde06d

Browse files
carenasgitster
authored andcommitted
http-push: prevent format overflow warning with gcc >= 9
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 <[email protected]> Suggested-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aeb582a commit 9dde06d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

http-push.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,8 @@ static void finish_request(struct transfer_request *request)
525525
if (request->headers != NULL)
526526
curl_slist_free_all(request->headers);
527527

528-
/* URL is reused for MOVE after PUT */
529-
if (request->state != RUN_PUT) {
528+
/* URL is reused for MOVE after PUT and used during FETCH */
529+
if (request->state != RUN_PUT && request->state != RUN_FETCH_PACKED) {
530530
FREE_AND_NULL(request->url);
531531
}
532532

0 commit comments

Comments
 (0)