[icinga-checkins] icinga.org: icinga-core/r1.8: idoutils: fix segfaults on reload with multiple neb modules of the same binary

git at icinga.org git at icinga.org
Wed May 22 22:52:14 CEST 2013


Module: icinga-core
Branch: r1.8
Commit: 4bbd583f6f9400597c4de39e80dd1e0eb82cf3c3
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=4bbd583f6f9400597c4de39e80dd1e0eb82cf3c3

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Sat May 18 19:30:31 2013 +0200

idoutils: fix segfaults on reload with multiple neb modules of the same binary

my bad, the loop did not fetch the correct next address pointer for
free'ing the module list items, resulting in a SIGSEGV.

fixed, but unveils a different problem - multiple handles of a binary
loaded via dlopen() share the same global symbol space which means that
the registered callback functions only work for the first match.

fixes #4033

Conflicts:
	Changelog

---

 Changelog      |    3 +++
 base/nebmods.c |    3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 0804ae5..809b385 100644
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,8 @@ UPGRADE NOTES
 * for configuration file changes, check the following for added/removed config options
 	- core, classic ui: sample-config/updates/
 	- idoutils: module/idoutils/config/updates
+* package locations may differ!
+
 
 1.8.5 - XX/XX/2013
 
@@ -24,6 +26,7 @@ FIXES
 
 * idoutils: idomod leaks memory on core reload #3749 - GB
 * idoutils: add workaround fix for num_rows_affected broken in libdbi/mariadb, returned ids are 0 #3728 - MF
+* idoutils: fix segfaults on reload with multiple neb modules of the same binary #4033 - MF
 
 * icinga.spec: add idoutils as transitional package (thx Stefan Marx, Michael Grüner) #3640 - MF
 * icinga.spec: fix double %{logdir}/gui/ definitions in icinga and icinga-gui (thx René Koch) #3802 - MF
diff --git a/base/nebmods.c b/base/nebmods.c
index 1a4c00d..c0bee00 100644
--- a/base/nebmods.c
+++ b/base/nebmods.c
@@ -126,14 +126,13 @@ int neb_free_module_list(void) {
 	nebmodule *next_module = NULL;
 	int x = OK;
 
-	for (temp_module = neb_module_list; temp_module;) {
+	for (temp_module = neb_module_list; temp_module; temp_module = next_module) {
 		next_module = temp_module->next;
 		my_free(temp_module->filename);
 		my_free(temp_module->args);
 		for (x = 0; x < NEBMODULE_MODINFO_NUMITEMS; x++)
 			my_free(temp_module->info[x]);
 		my_free(temp_module);
-		temp_module = next_module;
 	}
 
 	neb_module_list = NULL;





More information about the icinga-checkins mailing list