summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/conflict.c3
-rw-r--r--lib/libalpm/handle.c5
2 files changed, 2 insertions, 6 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 85429029..5714932c 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -547,7 +547,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
* consideration cannot itself be a link, as it might be unowned- path
* components can be safely checked as all directories are "unowned". */
if(!resolved_conflict && dbpkg && !S_ISLNK(lsbuf.st_mode)) {
- char *rpath = calloc(PATH_MAX, sizeof(char));
+ char rpath[PATH_MAX];
if(realpath(path, rpath)) {
const char *relative_rpath = rpath + rootlen;
if(_alpm_filelist_contains(alpm_pkg_get_files(dbpkg), relative_rpath)) {
@@ -556,7 +556,6 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
resolved_conflict = 1;
}
}
- free(rpath);
}
/* is the file unowned and in the backup list of the new package? */
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 2db27fbf..816162bd 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -333,7 +333,7 @@ alpm_errno_t _alpm_set_directory_option(const char *value,
char **storage, int must_exist)
{
struct stat st;
- char *real = NULL;
+ char real[PATH_MAX];
const char *path;
path = value;
@@ -344,9 +344,7 @@ alpm_errno_t _alpm_set_directory_option(const char *value,
if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
return ALPM_ERR_NOT_A_DIR;
}
- CALLOC(real, PATH_MAX, sizeof(char), return ALPM_ERR_MEMORY);
if(!realpath(path, real)) {
- free(real);
return ALPM_ERR_NOT_A_DIR;
}
path = real;
@@ -359,7 +357,6 @@ alpm_errno_t _alpm_set_directory_option(const char *value,
if(!*storage) {
return ALPM_ERR_MEMORY;
}
- free(real);
return 0;
}