Module: kamailio
Branch: 5.2
Commit: ddc0073c64df5ea1817ce2f727ea7c5e0b46b5ed
URL:
https://github.com/kamailio/kamailio/commit/ddc0073c64df5ea1817ce2f727ea7c5…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2018-12-30T18:42:45+01:00
cdp: fix two errors from coverty scan (missing check, var initialization)
- remove library call can fail, test for the error and log it
- initialize the msghdr variable with a memset
(cherry picked from commit 7d52bf6ce7188eaa57690766c231e55b5509db4f)
---
Modified: src/modules/cdp/receiver.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ddc0073c64df5ea1817ce2f727ea7c5…
Patch:
https://github.com/kamailio/kamailio/commit/ddc0073c64df5ea1817ce2f727ea7c5…
---
diff --git a/src/modules/cdp/receiver.c b/src/modules/cdp/receiver.c
index 4278bde951..c33554457a 100644
--- a/src/modules/cdp/receiver.c
+++ b/src/modules/cdp/receiver.c
@@ -157,10 +157,14 @@ static int make_send_pipe(serviced_peer_t *sp)
*/
static void close_send_pipe(serviced_peer_t *sp)
{
+ int tmp;
if (sp->send_pipe_name.s) {
close(sp->send_pipe_fd);
close(sp->send_pipe_fd_out);
- remove(sp->send_pipe_name.s);
+ tmp = remove(sp->send_pipe_name.s);
+ if (tmp == -1) {
+ LM_ERR("could not remove send pipe\n");
+ }
shm_free(sp->send_pipe_name.s);
sp->send_pipe_name.s=0;
sp->send_pipe_name.len=0;
@@ -269,6 +273,7 @@ static int send_fd(int pipe_fd,int fd, peer *p)
struct iovec iov[1];
int ret;
int *tmp = NULL;
+ memset(&msg, 0, sizeof(struct msghdr));
#ifdef HAVE_MSGHDR_MSG_CONTROL
struct cmsghdr* cmsg;