summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/delta.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-12-29 22:17:04 +0100
committerDan McGee <dan@archlinux.org>2012-01-01 04:03:24 +0100
commit627cf6bca88c241d7e0d5563db46f87f64792653 (patch)
tree8a991fcd2de132d1eee3ce08ef09779f685006a1 /lib/libalpm/delta.c
parent39cb865e71432fbce826d7526b1006be0e036761 (diff)
downloadpacman-627cf6bca88c241d7e0d5563db46f87f64792653.tar.gz
pacman-627cf6bca88c241d7e0d5563db46f87f64792653.tar.xz
Fix delta parsing
In commit 4c5e7af32f9, we changed this code to use the regex gathered substrings. However, we failed to correctly store the delta file name (leaking memory), as well as freeing the temporary string used to hold the file size string. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/delta.c')
-rw-r--r--lib/libalpm/delta.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index 1272558e..165cdef4 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -301,7 +301,7 @@ alpm_delta_t *_alpm_delta_parse(char *line)
/* start at index 1 -- match 0 is the entire match */
len = pmatch[1].rm_eo - pmatch[1].rm_so;
- STRNDUP(tmp, &line[pmatch[1].rm_so], len, return NULL);
+ STRNDUP(delta->delta, &line[pmatch[1].rm_so], len, return NULL);
len = pmatch[2].rm_eo - pmatch[2].rm_so;
STRNDUP(delta->delta_md5, &line[pmatch[2].rm_so], len, return NULL);
@@ -309,6 +309,7 @@ alpm_delta_t *_alpm_delta_parse(char *line)
len = pmatch[3].rm_eo - pmatch[3].rm_so;
STRNDUP(tmp, &line[pmatch[3].rm_so], len, return NULL);
delta->delta_size = _alpm_strtoofft(tmp);
+ free(tmp);
len = pmatch[4].rm_eo - pmatch[4].rm_so;
STRNDUP(delta->from, &line[pmatch[4].rm_so], len, return NULL);