summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-20 15:53:15 -0400
committerirungentoo <irungentoo@gmail.com>2013-08-20 15:53:15 -0400
commit747c290269db58f68ce05e976af974f3904ac3d0 (patch)
tree86759848cbd147668eb27a115195f9c7998b347b /core
parent2f66b312442f15f24adaf7216f5bc61390fdc016 (diff)
Fixed DHT_test.c and added some checks.
Diffstat (limited to 'core')
-rw-r--r--core/DHT.c2
-rw-r--r--core/Lossless_UDP.c2
-rw-r--r--core/Messenger.c2
-rw-r--r--core/net_crypto.c2
4 files changed, 7 insertions, 1 deletions
diff --git a/core/DHT.c b/core/DHT.c
index a139f2c5..c8994437 100644
--- a/core/DHT.c
+++ b/core/DHT.c
@@ -1145,6 +1145,8 @@ static void do_toping(DHT * dht)
1145 1145
1146DHT * new_DHT(Net_Crypto *c) 1146DHT * new_DHT(Net_Crypto *c)
1147{ 1147{
1148 if (c == NULL)
1149 return NULL;
1148 DHT * temp = calloc(1, sizeof(DHT)); 1150 DHT * temp = calloc(1, sizeof(DHT));
1149 if (temp == NULL) 1151 if (temp == NULL)
1150 return NULL; 1152 return NULL;
diff --git a/core/Lossless_UDP.c b/core/Lossless_UDP.c
index 3e71ffbb..7ece28e1 100644
--- a/core/Lossless_UDP.c
+++ b/core/Lossless_UDP.c
@@ -719,6 +719,8 @@ static int handle_data(void * object, IP_Port source, uint8_t *packet, uint32_t
719 719
720Lossless_UDP * new_lossless_udp(Networking_Core * net) 720Lossless_UDP * new_lossless_udp(Networking_Core * net)
721{ 721{
722 if(net == NULL)
723 return NULL;
722 Lossless_UDP * temp = calloc(1, sizeof(Lossless_UDP)); 724 Lossless_UDP * temp = calloc(1, sizeof(Lossless_UDP));
723 if (temp == NULL) 725 if (temp == NULL)
724 return NULL; 726 return NULL;
diff --git a/core/Messenger.c b/core/Messenger.c
index a6cbb3ac..dcf0235f 100644
--- a/core/Messenger.c
+++ b/core/Messenger.c
@@ -625,7 +625,7 @@ Messenger *initMessenger(void)
625{ 625{
626 Messenger *m = calloc(1, sizeof(Messenger)); 626 Messenger *m = calloc(1, sizeof(Messenger));
627 if ( ! m ) 627 if ( ! m )
628 return 0; 628 return NULL;
629 IP ip; 629 IP ip;
630 ip.i = 0; 630 ip.i = 0;
631 m->net = new_networking(ip, PORT); 631 m->net = new_networking(ip, PORT);
diff --git a/core/net_crypto.c b/core/net_crypto.c
index e36a1666..6c915f49 100644
--- a/core/net_crypto.c
+++ b/core/net_crypto.c
@@ -699,6 +699,8 @@ static void receive_crypto(Net_Crypto *c)
699 sets all the global connection variables to their default values. */ 699 sets all the global connection variables to their default values. */
700Net_Crypto * new_net_crypto(Networking_Core * net) 700Net_Crypto * new_net_crypto(Networking_Core * net)
701{ 701{
702 if (net == NULL)
703 return NULL;
702 Net_Crypto * temp = calloc(1, sizeof(Net_Crypto)); 704 Net_Crypto * temp = calloc(1, sizeof(Net_Crypto));
703 if (temp == NULL) 705 if (temp == NULL)
704 return NULL; 706 return NULL;