FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 01-01-2012, 02:07 AM
Dan McGee
 
Default 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>
---

Dave broke it.

lib/libalpm/delta.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index 1272558..165cdef 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);
--
1.7.8.1
 

Thread Tools




All times are GMT. The time now is 03:06 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org