Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2014-12-22 00:08:24 +1000
committerAllan McRae <allan@archlinux.org>2014-12-24 11:19:29 +1000
commite89223420796739a1c52e64fcbffc011085d0e52 (patch)
treeb95c1b728b635a769f7d14fe22d3cbbc20a093c9
parentf4796c905ca70f87461feb8e1fca3dc4afbe1217 (diff)
_alpm_dep_dup: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--lib/libalpm/deps.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index ca36270d..b12c6293 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -527,13 +527,17 @@ alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep)
alpm_depend_t *newdep;
CALLOC(newdep, 1, sizeof(alpm_depend_t), return NULL);
- STRDUP(newdep->name, dep->name, return NULL);
- STRDUP(newdep->version, dep->version, return NULL);
- STRDUP(newdep->desc, dep->desc, return NULL);
+ STRDUP(newdep->name, dep->name, goto error);
+ STRDUP(newdep->version, dep->version, goto error);
+ STRDUP(newdep->desc, dep->desc, goto error);
newdep->name_hash = dep->name_hash;
newdep->mod = dep->mod;
return newdep;
+
+error:
+ alpm_dep_free(newdep);
+ return NULL;
}
/* These parameters are messy. We check if this package, given a list of