mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-06 23:57:22 +02:00
gamemode-context: Avoid GameModeClient *cl
being NULL
There's no need in defining it at the top of the function. During rebase, I had one `if` accessing `cl->executable` too early but we were only storing the path in `executable` at that point. This change avoids accessing `cl` while it might be NULL. Signed-off-by: Kai Krakow <kai@kaishome.de>
This commit is contained in:
parent
0668e3b4da
commit
24f054659c
@ -403,7 +403,6 @@ int game_mode_context_register(GameModeContext *self, pid_t client, pid_t reques
|
||||
errno = 0;
|
||||
|
||||
/* Construct a new client if we can */
|
||||
GameModeClient *cl = NULL;
|
||||
char *executable = NULL;
|
||||
int err = -1;
|
||||
|
||||
@ -465,7 +464,7 @@ int game_mode_context_register(GameModeContext *self, pid_t client, pid_t reques
|
||||
}
|
||||
|
||||
/* From now on we depend on the client, initialize it */
|
||||
cl = game_mode_client_new(client, executable, requester);
|
||||
GameModeClient *cl = game_mode_client_new(client, executable, requester);
|
||||
if (!cl)
|
||||
goto error_cleanup;
|
||||
free(executable); /* we're now done with memory */
|
||||
@ -497,7 +496,6 @@ error_cleanup:
|
||||
if (errno != 0)
|
||||
LOG_ERROR("Failed to register client [%d]: %s\n", client, strerror(errno));
|
||||
free(executable);
|
||||
game_mode_client_unref(cl);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user