[sr-dev] git:master:b7d42f24: core: test if shm is initialized on early shutdown

Daniel-Constantin Mierla miconda at gmail.com
Fri Nov 27 07:50:21 CET 2020


Module: kamailio
Branch: master
Commit: b7d42f248bef70a06d8ae23f4a7652fd3f0e4e61
URL: https://github.com/kamailio/kamailio/commit/b7d42f248bef70a06d8ae23f4a7652fd3f0e4e61

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-11-27T07:49:27+01:00

core: test if shm is initialized on early shutdown

---

Modified: src/core/sr_module.c

---

Diff:  https://github.com/kamailio/kamailio/commit/b7d42f248bef70a06d8ae23f4a7652fd3f0e4e61.diff
Patch: https://github.com/kamailio/kamailio/commit/b7d42f248bef70a06d8ae23f4a7652fd3f0e4e61.patch

---

diff --git a/src/core/sr_module.c b/src/core/sr_module.c
index 56ba8bca59..ba6406ba46 100644
--- a/src/core/sr_module.c
+++ b/src/core/sr_module.c
@@ -43,6 +43,7 @@
 #include "sr_compat.h"
 #include "ppcfg.h"
 #include "async_task.h"
+#include "shm_init.h"
 
 #include <sys/stat.h>
 #include <regex.h>
@@ -114,7 +115,7 @@ static int *_ksr_shutdown_phase = NULL;
 
 int ksr_shutdown_phase_init(void)
 {
-	if(_ksr_shutdown_phase == NULL) {
+	if((_ksr_shutdown_phase == NULL) && (shm_initialized())) {
 		_ksr_shutdown_phase = (int*)shm_malloc(sizeof(int));
 	}
 	return 0;




More information about the sr-dev mailing list