From ffdc2c5396903ec0dd2b7ab4623f7f7674827885 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 8 Mar 2014 16:58:30 +1000 Subject: 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 --- lib/libalpm/pkghash.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/libalpm/pkghash.c') 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; -- cgit v1.2.3-24-g4f1b