Fix Coverty Scan CID
1521052 memory leak on fread fail in
pex_msg_update_request_init.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
memcpy(&ctx->addr, addr, sizeof(ctx->addr));
memcpy(ctx->auth_key, auth_key, sizeof(ctx->auth_key));
memcpy(ctx->priv_key, priv_key, sizeof(ctx->priv_key));
memcpy(&ctx->addr, addr, sizeof(ctx->addr));
memcpy(ctx->auth_key, auth_key, sizeof(ctx->auth_key));
memcpy(ctx->priv_key, priv_key, sizeof(ctx->priv_key));
- if (!fread(&ctx->req_id, sizeof(ctx->req_id), 1, pex_urandom))
+ if (!fread(&ctx->req_id, sizeof(ctx->req_id), 1, pex_urandom)) {
+ free(ctx);
list_add_tail(&ctx->list, &requests);
if (!gc_timer.pending)
uloop_timeout_set(&gc_timer, 1000);
list_add_tail(&ctx->list, &requests);
if (!gc_timer.pending)
uloop_timeout_set(&gc_timer, 1000);