Skip to content

Commit

Permalink
Free cloud_device if cloud_register_device fail
Browse files Browse the repository at this point in the history
This patch frees the struct cloud_device if there is no connection to
RabbitMQ.
  • Loading branch information
ramonhpr authored and vitbaq committed Nov 1, 2019
1 parent 7c55f81 commit 8018d04
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,10 @@ static int8_t msg_register(struct session *session,
snprintf(id, sizeof(id), "%016"PRIx64, kreq->id);

result = cloud_register_device(id, device_name);
if (result != 0)
if (result != 0) {
cloud_device_free(device_pending);
return result;
}

device_pending->id = l_strdup(id);
/**
Expand Down

0 comments on commit 8018d04

Please sign in to comment.