Skip to content

Commit 0b1a95e

Browse files
peffgitster
authored andcommitted
fetch_bundle_uri(): drop pointless NULL check
We check if "uri" is NULL, but it cannot be since we'd have segfaulted earlier in the function when we unconditionally called xstrdup() on it. In theory we might want to soften that xstrdup() to handle this case, but even before the code which added it via c23f592 (bundle-uri: fetch a list of bundles, 2022-10-12), we'd have fed NULL to fetch_bundle_uri_internal(), which would also segfault. The extra check isn't hurting anything, but it does cause Coverity to complain, and it may mislead somebody reading the code into thinking that a NULL uri is something we're prepared to handle. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ae6f064 commit 0b1a95e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bundle-uri.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,10 +795,10 @@ int fetch_bundle_uri(struct repository *r, const char *uri,
795795
init_bundle_list(&list);
796796

797797
/*
798-
* Do not fetch a NULL or empty bundle URI. An empty bundle URI
798+
* Do not fetch an empty bundle URI. An empty bundle URI
799799
* could signal that a configured bundle URI has been disabled.
800800
*/
801-
if (!uri || !*uri) {
801+
if (!*uri) {
802802
result = 0;
803803
goto cleanup;
804804
}

0 commit comments

Comments
 (0)