Module: kamailio
Branch: master
Commit: ab17b6811c94730f6428c218c9587d6365c9faa5
URL:
https://github.com/kamailio/kamailio/commit/ab17b6811c94730f6428c218c9587d6…
Author: Pantelis Kolatsis <pk(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2023-03-29T09:29:53Z
pdb: convert to memory logging helper, properly free memory in error cases
---
Modified: src/modules/pdb/pdb.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ab17b6811c94730f6428c218c9587d6…
Patch:
https://github.com/kamailio/kamailio/commit/ab17b6811c94730f6428c218c9587d6…
---
diff --git a/src/modules/pdb/pdb.c b/src/modules/pdb/pdb.c
index c6656ee62b5..e818b06efb3 100644
--- a/src/modules/pdb/pdb.c
+++ b/src/modules/pdb/pdb.c
@@ -541,6 +541,7 @@ static int add_server(char *host, char *port)
server->host = pkg_malloc(strlen(host)+1);
if (server->host == NULL) {
PKG_MEM_ERROR;
+ pkg_free(server);
return -1;
}
strcpy(server->host, host);
@@ -798,9 +799,14 @@ static int mod_init(void)
return -1;
}
- global_id = (uint16_t*)shm_malloc(sizeof(uint16_t));
-
- return 0;
+ global_id = (uint16_t*)shm_malloc(sizeof(uint16_t));
+ if(!global_id)
+ {
+ SHM_MEM_ERROR;
+ shm_free(active);
+ return -1;
+ }
+ return 0;
}
static int child_init (int rank)