mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-30 18:07:52 +00:00
APC: Fix memory leaks
Fixed memory leaks in apc and interapcomm modules. Signed-off-by: Rick Sommerville <rick.sommerville@netexperience.com>
This commit is contained in:
committed by
Rick Sommerville
parent
6021a14426
commit
7a634d80ed
@@ -30,4 +30,9 @@ static inline timer * tm_new_set( void (*hook)(struct _timer *), void *data, uns
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void tm_free(timer *t)
|
||||||
|
{
|
||||||
|
free(t);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ static void apc_dump( struct proto * P )
|
|||||||
static struct proto * apc_init(struct proto_config * c)
|
static struct proto * apc_init(struct proto_config * c)
|
||||||
{
|
{
|
||||||
struct proto * P = mb_allocz(sizeof(struct apc_proto));
|
struct proto * P = mb_allocz(sizeof(struct apc_proto));
|
||||||
|
|
||||||
|
printf("apc_init\n");
|
||||||
P->cf = c;
|
P->cf = c;
|
||||||
P->debug = c->debug;
|
P->debug = c->debug;
|
||||||
P->mrtdump = c->mrtdump;
|
P->mrtdump = c->mrtdump;
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ void apc_send_hello(struct apc_iface * ifa, int kind )
|
|||||||
struct apc_hello2_packet ps;
|
struct apc_hello2_packet ps;
|
||||||
unsigned int length, report = 0;
|
unsigned int length, report = 0;
|
||||||
struct apc_spec ApcSpec;
|
struct apc_spec ApcSpec;
|
||||||
|
char dst_ip[16];
|
||||||
|
|
||||||
if (WaitingToReelect )
|
if (WaitingToReelect )
|
||||||
return;
|
return;
|
||||||
@@ -202,8 +203,7 @@ void apc_send_hello(struct apc_iface * ifa, int kind )
|
|||||||
|
|
||||||
length += i * sizeof(u32);
|
length += i * sizeof(u32);
|
||||||
|
|
||||||
printf("HELLO packet sent via %s\n", ifa->ifname );
|
printf("HELLO packet sent via %s\n", ifa->ifname );
|
||||||
char *dst_ip = malloc(16);
|
|
||||||
memset(dst_ip, 0, 16);
|
memset(dst_ip, 0, 16);
|
||||||
if ((get_current_ip(dst_ip, IAC_IFACE)) < 0) {
|
if ((get_current_ip(dst_ip, IAC_IFACE)) < 0) {
|
||||||
printf("Error: Cannot get IP for %s", IAC_IFACE);
|
printf("Error: Cannot get IP for %s", IAC_IFACE);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ reset_lists(struct apc_proto *p, struct apc_neighbor *n)
|
|||||||
struct apc_neighbor * apc_neighbor_new(struct apc_iface * ifa)
|
struct apc_neighbor * apc_neighbor_new(struct apc_iface * ifa)
|
||||||
{
|
{
|
||||||
struct apc_neighbor * n = mb_allocz(sizeof(struct apc_neighbor));
|
struct apc_neighbor * n = mb_allocz(sizeof(struct apc_neighbor));
|
||||||
|
printf("apc_new_neighbor\n");
|
||||||
n->ifa = ifa;
|
n->ifa = ifa;
|
||||||
add_tail(&ifa->neigh_list, NODE n);
|
add_tail(&ifa->neigh_list, NODE n);
|
||||||
n->adj = 0;
|
n->adj = 0;
|
||||||
@@ -58,6 +58,8 @@ static void apc_neigh_down(struct apc_neighbor * n)
|
|||||||
rem_node(NODE n);
|
rem_node(NODE n);
|
||||||
|
|
||||||
printf("Neighbor %x on %s removed", n->rid, ifa->ifname );
|
printf("Neighbor %x on %s removed", n->rid, ifa->ifname );
|
||||||
|
tm_free(n->inactim);
|
||||||
|
mb_free(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ static void receive_data_uloop(struct uloop_fd *fd, unsigned int events)
|
|||||||
printf("recvfrom() failed");
|
printf("recvfrom() failed");
|
||||||
|
|
||||||
ra.cb(recv_data, recv_data_len);
|
ra.cb(recv_data, recv_data_len);
|
||||||
|
free(recv_data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ static void receive_data(struct ev_loop *ev, ev_io *io, int event)
|
|||||||
printf("recvfrom() failed");
|
printf("recvfrom() failed");
|
||||||
|
|
||||||
ra.cb(recv_data, recv_data_len);
|
ra.cb(recv_data, recv_data_len);
|
||||||
|
free(recv_data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ static int rx_msg(struct nl_msg *msg, void* arg)
|
|||||||
struct nlattr *attr[GENL_UCC_ATTR_MAX+1];
|
struct nlattr *attr[GENL_UCC_ATTR_MAX+1];
|
||||||
|
|
||||||
struct voip_session *data;
|
struct voip_session *data;
|
||||||
|
char dst_ip[16];
|
||||||
genlmsg_parse(nlmsg_hdr(msg), 0, attr,
|
genlmsg_parse(nlmsg_hdr(msg), 0, attr,
|
||||||
GENL_UCC_ATTR_MAX, genl_ucc_policy);
|
GENL_UCC_ATTR_MAX, genl_ucc_policy);
|
||||||
|
|
||||||
@@ -140,7 +141,6 @@ static int rx_msg(struct nl_msg *msg, void* arg)
|
|||||||
return NL_OK;
|
return NL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *dst_ip = malloc(16);
|
|
||||||
memset(dst_ip, 0, 16);
|
memset(dst_ip, 0, 16);
|
||||||
if((get_current_ip(dst_ip, IAC_IFACE)) < 0) {
|
if((get_current_ip(dst_ip, IAC_IFACE)) < 0) {
|
||||||
LOGI("Error: Cannot get IP for %s", IAC_IFACE);
|
LOGI("Error: Cannot get IP for %s", IAC_IFACE);
|
||||||
|
|||||||
Reference in New Issue
Block a user