Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/conflict.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-04-29 20:14:10 -0500
committerDan McGee <dan@archlinux.org>2012-04-29 20:14:10 -0500
commit52a9a5240ac8dc9eef1fc68c1bf4290b76fe09ae (patch)
treee37ae79bdf8c9b9dbf1d21864e292fdce96f81ab /lib/libalpm/conflict.c
parente0afd81d18fdc646bbf6d37a1627c0267176e167 (diff)
Move short-lived realpath buffers to the stack
There is little reason here to grab 4K from the heap only to return it a few lines later. Instead, just use the stack to hold the returned value saving ourselves the malloc/free cycle. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/conflict.c')
-rw-r--r--lib/libalpm/conflict.c3
1 files changed, 1 insertions, 2 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? */