summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorRenato Westphal <renato@openbsd.org>2017-10-02 19:05:54 +0200
committerGitHub <noreply@github.com>2017-10-02 19:05:54 +0200
commit47cf17fd5959c780b994ad30f12e288ff4806ca3 (patch)
tree9d42c8caadac4e661771affc2ea40fe4476be9a9 /zebra
parentMerge pull request #1254 from donaldsharp/irdp_no_crash (diff)
parentzebra: Cleanup ptm memory *after* we tell the sockets to clean up (diff)
downloadfrr-47cf17fd5959c780b994ad30f12e288ff4806ca3.tar.xz
frr-47cf17fd5959c780b994ad30f12e288ff4806ca3.zip
Merge pull request #1277 from donaldsharp/zebra_crash
Zebra crash and valgrind issues
Diffstat (limited to 'zebra')
-rw-r--r--zebra/kernel_netlink.c19
-rw-r--r--zebra/main.c2
-rw-r--r--zebra/rtadv.c6
3 files changed, 17 insertions, 10 deletions
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 015e11b3a..a5c36b0da 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -676,16 +676,21 @@ int netlink_talk(int (*filter)(struct sockaddr_nl *, struct nlmsghdr *, ns_id_t,
{
int status;
struct sockaddr_nl snl;
- struct iovec iov = {.iov_base = (void *)n, .iov_len = n->nlmsg_len};
- struct msghdr msg = {
- .msg_name = (void *)&snl,
- .msg_namelen = sizeof snl,
- .msg_iov = &iov,
- .msg_iovlen = 1,
- };
+ struct iovec iov;
+ struct msghdr msg;
int save_errno;
memset(&snl, 0, sizeof snl);
+ memset(&iov, 0, sizeof iov);
+ memset(&msg, 0, sizeof msg);
+
+ iov.iov_base = n;
+ iov.iov_len = n->nlmsg_len;
+ msg.msg_name = (void *)&snl;
+ msg.msg_namelen = sizeof snl;
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
snl.nl_family = AF_NETLINK;
n->nlmsg_seq = ++nl->seq;
diff --git a/zebra/main.c b/zebra/main.c
index 4864b4961..bf1971c47 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -127,8 +127,8 @@ static void sigint(void)
frr_early_fini();
- zebra_ptm_finish();
list_delete_all_node(zebrad.client_list);
+ zebra_ptm_finish();
if (retain_mode)
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 6091c75e5..633604120 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -176,11 +176,13 @@ static void rtadv_send_packet(int sock, struct interface *ifp)
*/
if (adata == NULL) {
/* XXX Free on shutdown. */
- adata = malloc(CMSG_SPACE(sizeof(struct in6_pktinfo)));
+ adata = calloc(1, CMSG_SPACE(sizeof(struct in6_pktinfo)));
- if (adata == NULL)
+ if (adata == NULL) {
zlog_err(
"rtadv_send_packet: can't malloc control data");
+ exit(-1);
+ }
}
/* Logging of packet. */