Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
[PATCH] git-local-fetch: Fix error checking and leak in setup_indices()
author
Sergey Vlasov
<vsu@altlinux.ru>
Fri, 23 Sep 2005 12:28:23 +0000
(16:28 +0400)
committer
Junio C Hamano
<junkio@cox.net>
Fri, 23 Sep 2005 21:30:45 +0000
(14:30 -0700)
setup_indices() did not check the return value of opendir(), and
did not have a corresponding closedir() call.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
local-fetch.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
d35bbe0
)
diff --git
a/local-fetch.c
b/local-fetch.c
index 8176532320e6d11e6134d686091632d721e5e5c6..b3947a96574774c6a2aa17fa4f181a8b6c55838f 100644
(file)
--- a/
local-fetch.c
+++ b/
local-fetch.c
@@
-38,6
+38,8
@@
static int setup_indices(void)
unsigned char sha1[20];
sprintf(filename, "%s/objects/pack/", path);
dir = opendir(filename);
+ if (!dir)
+ return -1;
while ((de = readdir(dir)) != NULL) {
int namelen = strlen(de->d_name);
if (namelen != 50 ||
@@
-46,6
+48,7
@@
static int setup_indices(void)
get_sha1_hex(de->d_name + 5, sha1);
setup_index(sha1);
}
+ closedir(dir);
return 0;
}