summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/launchpad_common.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/launchpad_common.c b/src/launchpad_common.c
index ef42c0a..19ad650 100644
--- a/src/launchpad_common.c
+++ b/src/launchpad_common.c
@@ -636,8 +636,15 @@ char *_get_libdir(const char *path)
char buf[PATH_MAX];
char *ptr;
+ if (path == NULL)
+ return NULL;
path_dup = strdup(path);
+ if (path_dup == NULL)
+ return NULL;
ptr = strrchr(path_dup, '/');
+ if (ptr == NULL)
+ return NULL;
+
*ptr = '\0';
snprintf(buf, sizeof(buf), "%s/../lib/", path_dup);