diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2012-08-11 23:35:13 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-09-18 15:28:34 +0200 |
commit | ea35ce5d2e067b6bfa6d4f443c5f8591a1bc9958 (patch) | |
tree | 52f1465ee30565baaef889c82b7ea5f279c59822 /src/pacman/util.c | |
parent | de7a5cf346c3ea8c26e43f4f17834af6fc38a13b (diff) | |
download | pacman-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.c | 5 |
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) { |