aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2021-05-16 01:22:08 +0200
committerJan200101 <sentrycraft123@gmail.com>2021-05-16 01:22:08 +0200
commit52f8abc09b0d97608ba9d5b57ea96c48a1390384 (patch)
tree7875d0c40b798fd57a3d4c856ab7ff06b21a838d /src
parent49b8d84cb78c6bdefc2d0427b5bb3d5d62677535 (diff)
downloadpolecat-52f8abc09b0d97608ba9d5b57ea96c48a1390384.tar.gz
polecat-52f8abc09b0d97608ba9d5b57ea96c48a1390384.zip
add NULL checks
Diffstat (limited to 'src')
-rw-r--r--src/lutris.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lutris.c b/src/lutris.c
index 1e4df0d..0dd999b 100644
--- a/src/lutris.c
+++ b/src/lutris.c
@@ -36,12 +36,15 @@ COMMAND(lutris, search)
// argv being modifyable is not always a given so lets
// lets make a mutable copy
char* str = strdup(argv[1]);
+ if (!str) return 1;
+
// in the case we need to do replacing we allocate more
// since we'll free in anyway
// the smallest strlen can return is 0 the longest
// escapeString can return is strlen*3
size_t allocsize = strlen(str) * 3;
str = realloc(str, allocsize);
+ if (!str) return 1;
lutris_escapeString(str, allocsize);
char* url = malloc(strlen(GAME_SEARCH_API) + strlen(str));
sprintf(url, GAME_SEARCH_API, str);
@@ -87,12 +90,15 @@ COMMAND(lutris, list)
// argv being modifyable is not always a given so lets
// lets make a mutable copy
char* str = strdup(argv[1]);
+ if (!str) return 1;
+
// in the case we need to do replacing we allocate more
// since we'll free in anyway
// the smallest strlen can return is 0 the longest
// escapeString can return is strlen*3
size_t allocsize = strlen(str) * 3;
str = realloc(str, allocsize);
+ if (!str) return 1;
lutris_escapeString(str, allocsize);
char* url = malloc(strlen(GAME_INSTALLER_API) + strlen(str));
sprintf(url, GAME_INSTALLER_API, str);