From 581359dca00edb4ca15a2a6054af454381072595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Fillod=2C=20F8CFE?= Date: Tue, 3 Nov 2009 22:03:56 +0000 Subject: [PATCH] Patch from Eric Sesterhenn, after cppcheck run: - kenwood/ic10.c: (error) Buffer access out-of-bounds - src/network.c: (error) Memory leak: p - tentec/paragon.c: (error) Memory leak: priv git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2765 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- kenwood/ic10.c | 2 +- src/network.c | 8 +++++--- tentec/paragon.c | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/kenwood/ic10.c b/kenwood/ic10.c index 469f75b48..57cf90a50 100644 --- a/kenwood/ic10.c +++ b/kenwood/ic10.c @@ -441,7 +441,7 @@ int ic10_get_mem(RIG *rig, vfo_t vfo, int *ch) */ int ic10_set_mem(RIG *rig, vfo_t vfo, int ch) { - char membuf[4], ackbuf[16]; + char membuf[8], ackbuf[16]; int mem_len, ack_len, retval; mem_len = sprintf(membuf, "MC %02d;", ch); diff --git a/src/network.c b/src/network.c index 0f0b9d3e8..10af2a0e0 100644 --- a/src/network.c +++ b/src/network.c @@ -90,12 +90,14 @@ static int getaddrinfo(const char *node, const char *service, { struct addrinfo *p; - p = malloc(sizeof(struct addrinfo)); - if (!p) - return ENOMEM; /* limitation: this replacement function only for IPv4 */ if (hints && hints->ai_family != AF_INET) return EINVAL; + + p = malloc(sizeof(struct addrinfo)); + if (!p) + return ENOMEM; + memset(p, 0, sizeof(struct addrinfo)); p->ai_family = hints->ai_family; p->ai_socktype = hints->ai_socktype; diff --git a/tentec/paragon.c b/tentec/paragon.c index fb9712189..f17357649 100644 --- a/tentec/paragon.c +++ b/tentec/paragon.c @@ -191,6 +191,7 @@ int tt585_init(RIG *rig) memset(priv, 0, sizeof(struct tt585_priv_data)); + rig->state.priv = priv; return RIG_OK; }