diff options
author | Allan McRae <allan@archlinux.org> | 2014-03-08 07:58:30 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-03-08 07:58:30 +0100 |
commit | ffdc2c5396903ec0dd2b7ab4623f7f7674827885 (patch) | |
tree | 1934e4c5234940b0694ef9f70ef71f0041d1f6d0 /lib/libalpm/be_local.c | |
parent | f3a280bc67c0f2e7b57f3772599f989b0df4d945 (diff) | |
download | pacman-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/be_local.c')
-rw-r--r-- | lib/libalpm/be_local.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 5474995e..9a9bdef6 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -743,11 +743,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq) /* since we know the length of the file string already, * we can do malloc + memcpy rather than strdup */ len += 1; - files[files_count].name = malloc(len); - if(files[files_count].name == NULL) { - _alpm_alloc_fail(len); - goto error; - } + MALLOC(files[files_count].name, len, goto error); memcpy(files[files_count].name, line, len); files_count++; } |