Explorar el Código

dmq: more initialization of pointers at declaration of vars

Daniel-Constantin Mierla hace 10 años
padre
commit
4d52cc0556
Se han modificado 2 ficheros con 5 adiciones y 3 borrados
  1. 3 3
      modules/dmq/dmq.c
  2. 2 0
      modules/dmq/notification_peer.c

+ 3 - 3
modules/dmq/dmq.c

@@ -75,12 +75,12 @@ sl_api_t slb;
 
 /** module variables */
 str dmq_request_method = str_init("KDMQ");
-dmq_worker_t* workers;
+dmq_worker_t* workers = NULL;
 dmq_peer_list_t* peer_list = 0;
 /* the list of dmq servers */
-dmq_node_list_t* node_list;
+dmq_node_list_t* node_list = NULL;
 // the dmq module is a peer itself for receiving notifications regarding nodes
-dmq_peer_t* dmq_notification_peer;
+dmq_peer_t* dmq_notification_peer = NULL;
 
 /** module functions */
 static int mod_init(void);

+ 2 - 0
modules/dmq/notification_peer.c

@@ -38,6 +38,8 @@ int *dmq_init_callback_done = 0;
 int add_notification_peer()
 {
 	dmq_peer_t not_peer;
+
+	memset(&not_peer, 0, sizeof(dmq_peer_t));
 	not_peer.callback = dmq_notification_callback;
 	not_peer.init_callback = NULL;
 	not_peer.description.s = "notification_peer";