Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2012-11-24 13:15:04 -0500
committerAllan McRae <allan@archlinux.org>2012-12-14 12:35:34 +1000
commit964640fbfcde48b7937a6c18964c78a3b11db3de (patch)
tree45673e7952283f229afda38c3f753b1052a4082e /src
parentc8417f3386155028015f7f9fc43f4c64a60acf4c (diff)
Plug various minor memory leaks
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/pacman.c5
-rw-r--r--src/pacman/util.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 1ca746d7..a25bbf84 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -812,10 +812,11 @@ int main(int argc, char *argv[])
/* we support reading targets from stdin if a cmdline parameter is '-' */
if(!isatty(fileno(stdin)) && alpm_list_find_str(pm_targets, "-")) {
size_t current_size = PATH_MAX;
- char *line = malloc(current_size);
+ char *vdata, *line = malloc(current_size);
/* remove the '-' from the list */
- pm_targets = alpm_list_remove_str(pm_targets, "-", NULL);
+ pm_targets = alpm_list_remove_str(pm_targets, "-", &vdata);
+ free(vdata);
i = 0;
while((line[i] = (char)fgetc(stdin)) != EOF) {
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 78cdf264..4c471dd6 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -560,6 +560,8 @@ static size_t table_calc_widths(const alpm_list_t *header,
colwidths = malloc(totalcols * sizeof(size_t));
coldata = calloc(totalcols, sizeof(int));
if(!colwidths || !coldata) {
+ free(colwidths);
+ free(coldata);
return 0;
}
/* header determines column count and initial values of longest_strs */