summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2014-03-08 07:58:30 +0100
committerAllan McRae <allan@archlinux.org>2014-03-08 07:58:30 +0100
commitffdc2c5396903ec0dd2b7ab4623f7f7674827885 (patch)
tree1934e4c5234940b0694ef9f70ef71f0041d1f6d0 /lib/libalpm/sync.c
parentf3a280bc67c0f2e7b57f3772599f989b0df4d945 (diff)
downloadpacman-ffdc2c5396903ec0dd2b7ab4623f7f7674827885.tar.gz
pacman-ffdc2c5396903ec0dd2b7ab4623f7f7674827885.tar.xz
Use MALLOC throughtout libalpm
Use MALLOC instead of malloc for safety in libalpm. Some changes are pure refactoring, but for others this provides a success check for memory allocation. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 7e40d986..a025b68a 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -1135,8 +1135,9 @@ static int check_validity(alpm_handle_t *handle,
if(_alpm_pkg_validate_internal(handle, v.path, v.pkg,
v.level, &v.siglist, &v.validation) == -1) {
+ struct validity *invalid;
v.error = handle->pm_errno;
- struct validity *invalid = malloc(sizeof(struct validity));
+ MALLOC(invalid, sizeof(struct validity), return -1);
memcpy(invalid, &v, sizeof(struct validity));
errors = alpm_list_add(errors, invalid);
} else {