i3-msg: strdup getenv() result before freeing

Fixes #1852.
This commit is contained in:
shdown 2015-08-20 22:55:23 +03:00 committed by Michael Stapelberg
parent a4ffb23d20
commit f8d8acd93c
1 changed files with 5 additions and 1 deletions

View File

@ -119,7 +119,11 @@ static yajl_callbacks reply_callbacks = {
};
int main(int argc, char *argv[]) {
socket_path = getenv("I3SOCK");
char *env_socket_path = getenv("I3SOCK");
if (env_socket_path)
socket_path = sstrdup(env_socket_path);
else
socket_path = NULL;
int o, option_index = 0;
uint32_t message_type = I3_IPC_MESSAGE_TYPE_COMMAND;
char *payload = NULL;