add: ma->enumerators = 0;
context: static module_addon * load_module_addon(const char * path){	module_addon * ma;	image_id addon_id;	module_info ** mi;	status_t status;	ASSERT(path);	addon_id = load_add_on(path);	if (addon_id < 0) {		printf("Failed to load %s addon: %s.\n", path, strerror(addon_id));		return NULL;	};		// printf("Addon %s loaded.\n", path);			ma = NULL;			status = get_image_symbol(addon_id, "modules", B_SYMBOL_TYPE_DATA, (void **) &mi);	if (status != B_OK) {		//  No "modules" symbol found in this addon		printf("Symbol \"modules\" not found in %s addon: not a module addon!\n", path);		goto error;	};	ma = (module_addon *) malloc(sizeof(*ma));	if (!ma)		// Gasp: not enough memory!		goto error;		LOCK_MODULES;	ma->ref_count = 0;	ma->keep_loaded = false;	ma->path = strdup(path);	ma->addon_image = addon_id;	ma->infos = mi;   	while(*mi)  {		module * m;		m = (module *) malloc(sizeof(*m));		if (!m)			// Gasp, again: not enough memory!			goto error;				m->ref_count = 0;		m->id = atomic_add(&g_next_module_id, 1);		m->info = (*mi);		m->name = strdup(m->info->name);		m->addon = ma;		m->keep_loaded = (m->info->flags & B_KEEP_LOADED) ? true : false;		            			   		m->state = MODULE_LOADED;		            					m->next = g_modules;		g_modules = m;   		mi++;	};	// add this module addon to the list	ma->next = g_module_addons;	g_module_addons = ma;	UNLOCK_MODULES;   				return ma;error:	printf("Error while load_module_addon(%s)\n", path);	if (ma) {		// remove any appended modules by this module addon until we got error... 		module * prev;		module * m;				prev = NULL;		m = g_modules;		while (m) {			if (m->addon == ma) {				module * tmp = m;								m = tmp->next;								if (prev)					prev->next = tmp->next;				else					g_modules = tmp->next;									if (tmp->name)					free(tmp->name);				free(tmp);				continue;			};						prev = m;			m = m->next;		};		UNLOCK_MODULES;			if (ma->path)			free(ma->path);			free(ma);	};	unload_add_on(addon_id);	// printf("Addon %s unloaded.\n", path);	return NULL;}