Explicitly initialize module if it wasn't initialized before the first registration

This commit is contained in:
Adam Dunkels 2011-08-29 21:59:08 +02:00
parent 6699f6a6f6
commit 2cbec29a42

View file

@ -139,6 +139,8 @@ servreg_hack_register(servreg_hack_id_t id, const uip_ipaddr_t *addr)
list. If we cannot allocate a service registration, we reuse one list. If we cannot allocate a service registration, we reuse one
from the service registrations made by others. */ from the service registrations made by others. */
servreg_hack_init();
for(t = list_head(own_services); for(t = list_head(own_services);
t != NULL; t != NULL;
t = list_item_next(t)) { t = list_item_next(t)) {
@ -189,6 +191,8 @@ servreg_hack_lookup(servreg_hack_id_t id)
{ {
servreg_hack_item_t *t; servreg_hack_item_t *t;
servreg_hack_init();
purge_registrations(); purge_registrations();
for(t = servreg_hack_list_head(); t != NULL; t = list_item_next(t)) { for(t = servreg_hack_list_head(); t != NULL; t = list_item_next(t)) {