diff options
author | Dimitri Staessens <[email protected]> | 2018-05-25 18:10:18 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2018-05-27 15:25:50 +0200 |
commit | 35b18cd6879e730f150dd2aacf761a00eeb4615f (patch) | |
tree | b7452121eeae161a2adb23226db84e4d49b480d5 /src/ipcpd/udp/main.c | |
parent | f7cdbe6414d79ce231cbe2ae79773b4b4051e68e (diff) | |
download | ouroboros-35b18cd6879e730f150dd2aacf761a00eeb4615f.tar.gz ouroboros-35b18cd6879e730f150dd2aacf761a00eeb4615f.zip |
ipcpd: Fix false positive incompatible malloc type
A malloc was performed with a mgmt_msg type and converted to a uint8_t
buffer for serialization, which triggers a false positive warning with
the clang static analyzer.
Signed-off-by: Dimitri Staessens <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd/udp/main.c')
-rw-r--r-- | src/ipcpd/udp/main.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/ipcpd/udp/main.c b/src/ipcpd/udp/main.c index be7491f4..26f993ce 100644 --- a/src/ipcpd/udp/main.c +++ b/src/ipcpd/udp/main.c @@ -236,23 +236,21 @@ static int ipcp_udp_port_alloc_resp(uint32_t dst_ip_addr, uint16_t dst_udp_port, int response) { - uint8_t * buf; struct mgmt_msg * msg; int ret; - buf = malloc(sizeof(*msg)); - if (buf == NULL) + msg = malloc(sizeof(*msg)); + if (msg == NULL) return -1; - msg = (struct mgmt_msg *) buf; msg->code = FLOW_REPLY; msg->src_udp_port = src_udp_port; msg->dst_udp_port = dst_udp_port; msg->response = response; - ret = send_shim_udp_msg(buf, sizeof(*msg), dst_ip_addr); + ret = send_shim_udp_msg((uint8_t *) msg, sizeof(*msg), dst_ip_addr); - free(buf); + free(msg); return ret; } |