summaryrefslogtreecommitdiffstats
path: root/src/pacman/util.c
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2012-08-11 23:35:13 +0200
committerDan McGee <dan@archlinux.org>2012-09-18 15:28:34 +0200
commitea35ce5d2e067b6bfa6d4f443c5f8591a1bc9958 (patch)
tree52f1465ee30565baaef889c82b7ea5f279c59822 /src/pacman/util.c
parentde7a5cf346c3ea8c26e43f4f17834af6fc38a13b (diff)
downloadpacman-ea35ce5d2e067b6bfa6d4f443c5f8591a1bc9958.tar.gz
pacman-ea35ce5d2e067b6bfa6d4f443c5f8591a1bc9958.tar.xz
query_fileowner, mdirname: add error checks
Also consolidates cleanup for query_fileowner. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r--src/pacman/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 2d1b7626..5079b4ce 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -239,7 +239,10 @@ char *mdirname(const char *path)
return strdup(".");
}
- ret = strdup(path);
+ if((ret = strdup(path)) == NULL) {
+ return NULL;
+ }
+
last = strrchr(ret, '/');
if(last != NULL) {