diff options
author | Allan McRae <allan@archlinux.org> | 2014-12-24 10:56:37 +1000 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-12-24 11:19:30 +1000 |
commit | 21faf1682e380cc95aa766eed6c3c7b62d2b1843 (patch) | |
tree | 9620481bdd73df7a60f2089b1cce6c3eecc1eea2 /lib/libalpm | |
parent | 2114ef18742142a7eb1df367558967a754be8059 (diff) | |
download | pacman-21faf1682e380cc95aa766eed6c3c7b62d2b1843.tar.xz |
mount_point_list: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/diskspace.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index af87f755..c94cab31 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -112,7 +112,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle) while((mnt = getmntent(fp))) { CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); - STRDUP(mp->mount_dir, mnt->mnt_dir, RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); + STRDUP(mp->mount_dir, mnt->mnt_dir, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); mp->mount_dir_len = strlen(mp->mount_dir); mount_points = alpm_list_add(mount_points, mp); @@ -135,7 +135,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle) while((ret = getmntent(fp, &mnt)) == 0) { CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); - STRDUP(mp->mount_dir, mnt->mnt_mountp, RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); + STRDUP(mp->mount_dir, mnt->mnt_mountp, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); mp->mount_dir_len = strlen(mp->mount_dir); mount_points = alpm_list_add(mount_points, mp); @@ -162,7 +162,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle) for(; entries-- > 0; fsp++) { CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); - STRDUP(mp->mount_dir, fsp->f_mntonname, RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); + STRDUP(mp->mount_dir, fsp->f_mntonname, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); mp->mount_dir_len = strlen(mp->mount_dir); memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE)); #if defined(HAVE_GETMNTINFO_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_FLAG) |