aboutsummaryrefslogtreecommitdiff
path: root/src/lutris.c
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2021-04-24 17:30:20 +0200
committerJan200101 <sentrycraft123@gmail.com>2021-04-24 17:30:20 +0200
commit67d5d1b742584ffeb9859eb7b92a41e0d365622d (patch)
treec9903671425f1287ed93b6a3ee735a28b3197968 /src/lutris.c
parent6867c3f51eb7702a1379a66f12627b35924edbed (diff)
downloadpolecat-67d5d1b742584ffeb9859eb7b92a41e0d365622d.tar.gz
polecat-67d5d1b742584ffeb9859eb7b92a41e0d365622d.zip
update allocsize with the largest size we might possibly need
Diffstat (limited to 'src/lutris.c')
-rw-r--r--src/lutris.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lutris.c b/src/lutris.c
index bd2a2d4..7d663c0 100644
--- a/src/lutris.c
+++ b/src/lutris.c
@@ -34,7 +34,9 @@ COMMAND(lutris, search)
char* str = strdup(argv[1]);
// in the case we need to do replacing we allocate more
// since we'll free in anyway
- size_t allocsize = strlen(str) * 2;
+ // 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);
lutris_escapeString(str, allocsize);
char* url = malloc(strlen(GAME_SEARCH_API) + strlen(str));
@@ -83,7 +85,9 @@ COMMAND(lutris, list)
char* str = strdup(argv[1]);
// in the case we need to do replacing we allocate more
// since we'll free in anyway
- size_t allocsize = strlen(str) * 2;
+ // 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);
lutris_escapeString(str, allocsize);
char* url = malloc(strlen(GAME_INSTALLER_API) + strlen(str));