summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-24 09:14:25 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-04-24 09:14:25 +0000
commit45247b4e35cb219d5aaf5e4ed5b8be79fb410706 (patch)
tree90487761e081fcc4e3be5c62288dd76ac3cf893d /lib/libalpm
parente2b474b1309594c610a2cf25f35b349575d88223 (diff)
downloadpacman-45247b4e35cb219d5aaf5e4ed5b8be79fb410706.tar.xz
fixed some potential resource leaks
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 48a912d9..d08af4e2 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -61,9 +61,11 @@ long _alpm_gzopen_frontend(char *pathname, int oflags, int mode)
return -1;
}
if((oflags & O_CREAT) && fchmod(fd, mode)) {
+ close(fd);
return -1;
}
if(!(gzf = gzdopen(fd, gzoflags))) {
+ close(fd);
errno = ENOMEM;
return -1;
}
@@ -114,6 +116,7 @@ int _alpm_copyfile(char *src, char *dest)
}
out = fopen(dest, "w");
if(out == NULL) {
+ fclose(in);
return(1);
}
@@ -162,7 +165,7 @@ char *_alpm_strtrim(char *str)
return(str);
}
- pch = (char*)(str + (strlen(str) - 1));
+ pch = (char *)(str + (strlen(str) - 1));
while(isspace(*pch)) {
pch--;
}
@@ -218,6 +221,8 @@ int _alpm_lckmk(char *file)
*/
int _alpm_lckrm(char *file)
{
+ /* ORE
+ we should close the file descriptor opened by lckmk */
return(unlink(file) == -1);
}