summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/conflict.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/conflict.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/conflict.c')
-rw-r--r--lib/libalpm/conflict.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 40cbb953..c886f785 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -48,7 +48,7 @@ static alpm_conflict_t *conflict_new(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2,
{
alpm_conflict_t *conflict;
- MALLOC(conflict, sizeof(alpm_conflict_t), return NULL);
+ CALLOC(conflict, 1, sizeof(alpm_conflict_t), return NULL);
conflict->package1_hash = pkg1->name_hash;
conflict->package2_hash = pkg2->name_hash;
@@ -273,7 +273,7 @@ static alpm_list_t *add_fileconflict(alpm_handle_t *handle,
alpm_pkg_t *pkg1, alpm_pkg_t *pkg2)
{
alpm_fileconflict_t *conflict;
- MALLOC(conflict, sizeof(alpm_fileconflict_t), goto error);
+ CALLOC(conflict, 1, sizeof(alpm_fileconflict_t), goto error);
STRDUP(conflict->target, pkg1->name, goto error);
STRDUP(conflict->file, filestr, goto error);