summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/du_buff.c5
-rw-r--r--src/lib/irm.c12
-rw-r--r--src/lib/sockets.c4
3 files changed, 15 insertions, 6 deletions
diff --git a/src/lib/du_buff.c b/src/lib/du_buff.c
index bfb33339..08e3d23e 100644
--- a/src/lib/du_buff.c
+++ b/src/lib/du_buff.c
@@ -85,6 +85,9 @@ struct buffer * buffer_create (size_t size, size_t headspace, size_t len)
bool head_block = true;
head = malloc(sizeof *head);
+ if (head == NULL)
+ return NULL;
+
head->size=0;
head->data=NULL;
@@ -111,6 +114,7 @@ struct buffer * buffer_create (size_t size, size_t headspace, size_t len)
buf = malloc(sizeof *buf);
if (buf == NULL) {
LOG_WARN("Could not allocate struct.");
+ free(head);
return NULL;
}
@@ -119,6 +123,7 @@ struct buffer * buffer_create (size_t size, size_t headspace, size_t len)
if (buf->data == NULL) {
LOG_WARN("Could not allocate memory block.");
buffer_destroy_list(head);
+ free(head);
return NULL;
}
} else {
diff --git a/src/lib/irm.c b/src/lib/irm.c
index 97000029..519b4eb8 100644
--- a/src/lib/irm.c
+++ b/src/lib/irm.c
@@ -26,6 +26,7 @@
#include <ouroboros/common.h>
#include <ouroboros/logs.h>
#include <ouroboros/sockets.h>
+#include <stdlib.h>
static int send_irm_msg(struct irm_msg * msg)
{
@@ -47,8 +48,11 @@ static int send_irm_msg(struct irm_msg * msg)
return -1;
}
- close(sockfd);
- return 0;
+ free(buf->data);
+ free(buf);
+
+ close(sockfd);
+ return 0;
}
int irm_create_ipcp(rina_name_t name,
@@ -87,13 +91,13 @@ int irm_destroy_ipcp(rina_name_t name)
}
int irm_bootstrap_ipcp(rina_name_t name,
- struct dif_info info)
+ struct dif_config conf)
{
struct irm_msg msg;
msg.code = IRM_BOOTSTRAP_IPCP;
msg.name = &name;
- msg.info = &info;
+ msg.conf = &conf;
if (send_irm_msg(&msg)) {
LOG_ERR("Failed to send message to daemon");
diff --git a/src/lib/sockets.c b/src/lib/sockets.c
index c0331063..eebd223b 100644
--- a/src/lib/sockets.c
+++ b/src/lib/sockets.c
@@ -48,7 +48,7 @@ int client_socket_open(char * file_name)
if (connect(sockfd,
(struct sockaddr *) &serv_addr,
sizeof(serv_addr))) {
- LOG_ERR("Failed to connect to server");
+ LOG_ERR("Failed to connect to daemon");
return -1;
}
@@ -223,7 +223,7 @@ buffer_t * serialize_irm_msg(struct irm_msg * msg)
case IRM_DESTROY_IPCP:
break;
case IRM_BOOTSTRAP_IPCP:
- /* FIXME: Fields missing, need to define dif_info properly */
+ /* FIXME: Fields missing, need to define dif_conf properly */
break;
case IRM_ENROLL_IPCP:
if (msg->dif_name == NULL) {