summaryrefslogtreecommitdiff
path: root/commit-graph.h
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-06-07 17:50:04 +0200
committerJunio C Hamano <gitster@pobox.com>2022-06-07 10:23:47 -0700
commit323822c72be59ce2900cc036c5bad4f10bafbb53 (patch)
treedb991a10060d1c2d5055add05ef6d8c4695e250b /commit-graph.h
parent338959da3e46340dfcec3af361c6062c3a992668 (diff)
remote.c: don't dereference NULL in freeing loop
Fix a bug in fd3cb0501e1 (remote: move static variables into per-repository struct, 2021-11-17) where we'd free(remote->pushurl[i]) after having NULL'd out remote->pushurl. itself. We free "remote->pushurl" in the next "for"-loop, so doing this appears to have been a copy/paste error. Before this change GCC 12's -fanalyzer would correctly note that we'd dereference NULL in this case, this change fixes that: remote.c: In function ‘remote_clear’: remote.c:153:17: error: dereference of NULL ‘*remote.pushurl’ [CWE-476] [-Werror=analyzer-null-dereference] 153 | free((char *)remote->pushurl[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [...] Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.h')
0 files changed, 0 insertions, 0 deletions