summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/deps.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2014-12-24 02:55:49 +0100
committerAllan McRae <allan@archlinux.org>2014-12-27 08:08:32 +0100
commit60d958c78bf5c6fca761492b4849dd36f098eb41 (patch)
treed0d09052ae409773a1a4a05d4b50ea60ee74bb49 /lib/libalpm/deps.c
parentbe4198b34e01242e481664776c51936a150c1ff8 (diff)
downloadpacman-60d958c78bf5c6fca761492b4849dd36f098eb41.tar.gz
pacman-60d958c78bf5c6fca761492b4849dd36f098eb41.tar.xz
Initialize memory to prevent issues when freeing on error
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/deps.c')
-rw-r--r--lib/libalpm/deps.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 2a21443e..d4fbf950 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -48,7 +48,7 @@ static alpm_depmissing_t *depmiss_new(const char *target, alpm_depend_t *dep,
{
alpm_depmissing_t *miss;
- MALLOC(miss, sizeof(alpm_depmissing_t), return NULL);
+ CALLOC(miss, 1, sizeof(alpm_depmissing_t), return NULL);
STRDUP(miss->target, target, goto error);
miss->depend = _alpm_dep_dup(dep);
@@ -469,7 +469,7 @@ alpm_depend_t SYMEXPORT *alpm_dep_from_string(const char *depstring)
return NULL;
}
- MALLOC(depend, sizeof(alpm_depend_t), return NULL);
+ CALLOC(depend, 1, sizeof(alpm_depend_t), return NULL);
/* Note the extra space in ": " to avoid matching the epoch */
if((desc = strstr(depstring, ": ")) != NULL) {