Skip to content

Commit

Permalink
Fix a memory leak in mgos_gcp_mqtt_connect
Browse files Browse the repository at this point in the history
CL: gcp: Fix a memory leak in mgos_gcp_mqtt_connect
  • Loading branch information
rojer committed Jan 16, 2020
1 parent 0cbd89c commit db11315
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mgos_gcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ static void mgos_gcp_mqtt_connect(struct mg_connection *c,
LOG(LL_DEBUG, ("JWT Refresh Timeout: %d", ((int) ttl - 30) * 1000));

opts->user_name = "unused";
opts->password = ctx.jwt.buf; /* No mbuf_free, caller owns the buffer. */
opts->password = ctx.jwt.buf;
mg_send_mqtt_handshake_opt(c, cid, *opts);
mbuf_free(&ctx.jwt);
free(cid);
(void) client_id;
}
Expand Down

0 comments on commit db11315

Please sign in to comment.