summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2016-03-03 17:15:03 +0100
committerDimitri Staessens <[email protected]>2016-03-03 17:15:03 +0100
commit11c709cc077746621e3d9ff2411a748d400f1d4f (patch)
treebca214380c41311fe1d7e9d05f77f42c4e1b3161 /src/irmd/main.c
parent52a5113760802e16b07d9d954237871d52cff70a (diff)
parentef2a4f128fa0250db5457069e397bf328c6da25e (diff)
downloadouroboros-11c709cc077746621e3d9ff2411a748d400f1d4f.tar.gz
ouroboros-11c709cc077746621e3d9ff2411a748d400f1d4f.zip
Merged in sandervrijders/ouroboros/be-memleaks (pull request #19)
lib, irmd: Fix memleaks
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r--src/irmd/main.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 73533ef0..0c69de2f 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -78,18 +78,12 @@ static void unreg_ipcp(rina_name_t * name,
int main()
{
int sockfd;
- uint8_t * buf;
+ uint8_t buf[IRM_MSG_BUF_SIZE];
sockfd = server_socket_open(IRM_SOCK_PATH);
if (sockfd < 0)
return -1;
- buf = malloc(sizeof(*buf) * IRM_MSG_BUF_SIZE);
- if (buf == NULL) {
- LOG_ERR("Cannot allocate memory");
- return -ENOMEM;
- }
-
while (true) {
int cli_sockfd;
struct irm_msg * msg;
@@ -140,12 +134,11 @@ int main()
LOG_ERR("Don't know that message code");
break;
}
+ free(msg);
}
close(cli_sockfd);
}
- free(buf);
-
return 0;
}