projects
/
project
/
unetd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
faaf9ce
)
pex-msg: fix memory leak on fread fail in pex_msg_update_request_init
author
Christian Marangi
<ansuelsmth@gmail.com>
Fri, 26 May 2023 17:25:35 +0000
(19:25 +0200)
committer
Christian Marangi
<ansuelsmth@gmail.com>
Fri, 26 May 2023 17:25:35 +0000
(19:25 +0200)
Fix Coverty Scan CID
1521052
memory leak on fread fail in
pex_msg_update_request_init.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
pex-msg.c
patch
|
blob
|
history
diff --git
a/pex-msg.c
b/pex-msg.c
index 1f00681f7b6e80cda584e30e8ed0ae6c05720d2f..716fe0cc5a600b3fe6dc6905ed58f16dcbe5287b 100644
(file)
--- a/
pex-msg.c
+++ b/
pex-msg.c
@@
-424,8
+424,10
@@
pex_msg_update_request_init(const uint8_t *pubkey, const uint8_t *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);
return NULL;
+ }
list_add_tail(&ctx->list, &requests);
if (!gc_timer.pending)
uloop_timeout_set(&gc_timer, 1000);