From 7e43d9c4693a6b97bbe7895bf214555f815b23c5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 21 Dec 2016 01:45:19 +0100 Subject: [PATCH] Attempt to fix Coverity ID 158346 --- tasks/task_autodetect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index ac8ac88277..ec0a023db4 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -361,6 +361,9 @@ bool input_autoconfigure_disconnect(unsigned i, const char *ident) retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task)); autoconfig_disconnect_t *state = (autoconfig_disconnect_t*)calloc(1, sizeof(*state)); + if (!state || !task) + goto error; + msg[0] = '\0'; state->idx = i; @@ -369,9 +372,6 @@ bool input_autoconfigure_disconnect(unsigned i, const char *ident) msg_hash_to_str(MSG_DEVICE_DISCONNECTED_FROM_PORT), i, ident); - if (!task || !state) - goto error; - strlcpy(state->msg, msg, sizeof(state->msg)); task->state = state;