Module: kamailio Branch: master Commit: 7d52bf6ce7188eaa57690766c231e55b5509db4f URL: https://github.com/kamailio/kamailio/commit/7d52bf6ce7188eaa57690766c231e55b...
Author: Henning Westerholt hw@kamailio.org Committer: Henning Westerholt hw@kamailio.org Date: 2018-12-30T00:15:46+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
---
Modified: src/modules/cdp/receiver.c
---
Diff: https://github.com/kamailio/kamailio/commit/7d52bf6ce7188eaa57690766c231e55b... Patch: https://github.com/kamailio/kamailio/commit/7d52bf6ce7188eaa57690766c231e55b...
---
diff --git a/src/modules/cdp/receiver.c b/src/modules/cdp/receiver.c index 2b4da266e3..6257d15362 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;