[hipl-commit] [tiny] Rev 3706: Small improvements in hadb.c

  • From: Tim Just <tim.just@xxxxxxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Fri, 19 Mar 2010 17:55:57 +0200

Committer: Tim Just <tim.just@xxxxxxxxxxxxxx>
Date: 19/03/2010 at 17:55:57
Revision: 3706
Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: tiny

Log:
  Small improvements in hadb.c
  
  Initialize pointers with NULL and don't cast malloc returns.

Modified:
  M  hipd/hadb.c

=== modified file 'hipd/hadb.c'
--- hipd/hadb.c 2010-03-17 15:05:58 +0000
+++ hipd/hadb.c 2010-03-19 15:55:15 +0000
@@ -680,8 +680,7 @@
 {
     hip_ha_t *entry = NULL;
 
-    entry = (hip_ha_t *) malloc(sizeof(struct hip_hadb_state));
-    if (entry == NULL) {
+    if (!(entry = malloc(sizeof(struct hip_hadb_state)))) {
         return NULL;
     }
 
@@ -1156,7 +1155,7 @@
 void hip_hadb_delete_state(hip_ha_t *ha)
 {
     hip_list_t *item = NULL, *tmp = NULL;
-    struct hip_peer_addr_list_item *addr_li;
+    struct hip_peer_addr_list_item *addr_li = NULL;
     int i;
 
     HIP_DEBUG("ha=0x%p\n", ha);

Other related posts:

  • » [hipl-commit] [tiny] Rev 3706: Small improvements in hadb.c - Tim Just