Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/pkghash.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2014-03-08 16:58:30 +1000
committerAllan McRae <allan@archlinux.org>2014-03-08 16:58:30 +1000
commitffdc2c5396903ec0dd2b7ab4623f7f7674827885 (patch)
tree1934e4c5234940b0694ef9f70ef71f0041d1f6d0 /lib/libalpm/pkghash.c
parentf3a280bc67c0f2e7b57f3772599f989b0df4d945 (diff)
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/pkghash.c')
-rw-r--r--lib/libalpm/pkghash.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/libalpm/pkghash.c b/lib/libalpm/pkghash.c
index 2f682784..a740233d 100644
--- a/lib/libalpm/pkghash.c
+++ b/lib/libalpm/pkghash.c
@@ -172,10 +172,7 @@ static alpm_pkghash_t *pkghash_add_pkg(alpm_pkghash_t *hash, alpm_pkg_t *pkg,
position = get_hash_position(pkg->name_hash, hash);
- ptr = malloc(sizeof(alpm_list_t));
- if(ptr == NULL) {
- return hash;
- }
+ MALLOC(ptr, sizeof(alpm_list_t), return hash);
ptr->data = pkg;
ptr->prev = ptr;