1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-12-08 08:46:35 +01:00

add missing malloc error checks and fix widechar to char comparison

This commit is contained in:
jfreegman
2020-11-03 00:59:28 -05:00
parent 1bbd50aac7
commit 3f02e119f4
3 changed files with 20 additions and 5 deletions

View File

@@ -153,7 +153,12 @@ static char *extract_socket_path(const char *info)
return NULL;
}
path = (char *) malloc(end - pos + 1);
path = malloc(end - pos + 1);
if (path == NULL) {
return NULL;
}
*end = '\0';
return strcpy(path, pos);
}
@@ -310,7 +315,12 @@ static int tmux_is_detached(void)
session_info_stream = NULL;
/* prepare search string, for finding the current session's entry */
search_str = (char *) malloc(numstr_len + 2);
search_str = malloc(numstr_len + 2);
if (search_str == NULL) {
goto fail;
}
search_str[0] = '\n';
strcpy(search_str + 1, mplex_data);