Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2023-04-22 16:56:46 +0300
committerJunio C Hamano <gitster@pobox.com>2023-04-24 21:09:16 +0300
commit0b1a95ef793716e7e51caf929b971ee2cbf4116d (patch)
treedf976d432483786899de5b15c2292efaf7169fa1 /bundle-uri.c
parentae6f064fd7f0925cc8985769750a1367a4c24194 (diff)
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 c23f592117 (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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bundle-uri.c')
-rw-r--r--bundle-uri.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bundle-uri.c b/bundle-uri.c
index e2b267cc02..f22490a2ca 100644
--- a/bundle-uri.c
+++ b/bundle-uri.c
@@ -795,10 +795,10 @@ int fetch_bundle_uri(struct repository *r, const char *uri,
init_bundle_list(&list);
/*
- * Do not fetch a NULL or empty bundle URI. An empty bundle URI
+ * Do not fetch an empty bundle URI. An empty bundle URI
* could signal that a configured bundle URI has been disabled.
*/
- if (!uri || !*uri) {
+ if (!*uri) {
result = 0;
goto cleanup;
}