it's an array of char, not an array of pointers

This commit is contained in:
Thomas Debesse 2014-11-09 02:42:35 +01:00
parent e69d6bfadb
commit 96dafb20dc

View File

@ -715,8 +715,8 @@ static void quake_parse_server (char *token[], int n, struct server *server) {
server->name = g_strdup (token[2]);
}
else {
server->name = g_malloc0 (sizeof(char*) * strlen (token[2]));
debug(6, "maxsize:%d", (int) (sizeof(char*) * strlen (token[2])));
server->name = g_malloc0 (sizeof (char) * strlen (token[2]) + 1);
debug(6, "maxsize:%d", (int) (sizeof (char) * strlen (token[2]) + 1));
q3_unescape (server->name, token[2]);
}
}
@ -1839,7 +1839,7 @@ static void q3_analyze_serverinfo (struct server *s) {
if (s->type == COD_SERVER) {
if (s->gametype) {
// unescape in place, for backward compatibility
gchar* tmp_gametype = g_malloc0 (sizeof(gchar*) * strlen (s->gametype));
gchar* tmp_gametype = g_malloc0 (sizeof (gchar) * strlen (s->gametype) + 1);
q3_unescape(tmp_gametype, s->gametype);
strcpy(s->gametype, tmp_gametype);
g_free(tmp_gametype);