summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/delta.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-16 20:03:33 +0200
committerDan McGee <dan@archlinux.org>2011-06-20 07:10:11 +0200
commit0f26e3aa5b91ffc0a5bef9a0f0bb9d40ec198407 (patch)
tree89362d83560d4eb8b61f9227ec842801819d92ea /lib/libalpm/delta.c
parentdeb5601d8d19760fd569abe3508786d97cc1ceba (diff)
downloadpacman-0f26e3aa5b91ffc0a5bef9a0f0bb9d40ec198407.tar.gz
pacman-0f26e3aa5b91ffc0a5bef9a0f0bb9d40ec198407.tar.xz
Correctly duplicate delta objects
We were using copy_data before; this works for the struct itself but not the strings contained within. Fix it up by duplicating all the data as we do with our other structures. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/delta.c')
-rw-r--r--lib/libalpm/delta.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index fed84f45..fc7a0f75 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -314,11 +314,25 @@ pmdelta_t *_alpm_delta_parse(char *line)
void _alpm_delta_free(pmdelta_t *delta)
{
- FREE(delta->from);
- FREE(delta->to);
FREE(delta->delta);
FREE(delta->delta_md5);
+ FREE(delta->from);
+ FREE(delta->to);
FREE(delta);
}
+pmdelta_t *_alpm_delta_dup(const pmdelta_t *delta)
+{
+ pmdelta_t *newdelta;
+ CALLOC(newdelta, 1, sizeof(pmdelta_t), return NULL);
+ STRDUP(newdelta->delta, delta->delta, return NULL);
+ STRDUP(newdelta->delta_md5, delta->delta_md5, return NULL);
+ STRDUP(newdelta->from, delta->from, return NULL);
+ STRDUP(newdelta->to, delta->to, return NULL);
+ newdelta->delta_size = delta->delta_size;
+ newdelta->download_size = delta->download_size;
+
+ return newdelta;
+}
+
/* vim: set ts=2 sw=2 noet: */