Module: kamailio
Branch: master
Commit: 508db5a6cda890c5df7c093e644f9659a1eff188
URL:
https://github.com/kamailio/kamailio/commit/508db5a6cda890c5df7c093e644f965…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2018-12-28T15:44:16+01:00
app_java: use mem error macros
---
Modified: src/modules/app_java/app_java_mod.c
Modified: src/modules/app_java/java_iface.c
Modified: src/modules/app_java/java_msgobj.c
Modified: src/modules/app_java/java_native_methods.c
Modified: src/modules/app_java/java_sig_parser.c
Modified: src/modules/app_java/utils.c
---
Diff:
https://github.com/kamailio/kamailio/commit/508db5a6cda890c5df7c093e644f965…
Patch:
https://github.com/kamailio/kamailio/commit/508db5a6cda890c5df7c093e644f965…
---
diff --git a/src/modules/app_java/app_java_mod.c b/src/modules/app_java/app_java_mod.c
index 393e4aa349..b789f77cf4 100644
--- a/src/modules/app_java/app_java_mod.c
+++ b/src/modules/app_java/app_java_mod.c
@@ -123,8 +123,7 @@ static int mod_init(void)
options = (JavaVMOption *)pkg_malloc(sizeof(JavaVMOption));
if(!options) {
- LM_ERR("pkg_malloc() failed: Couldn't initialize Java VM: Not enough "
- "memory\n");
+ PKG_MEM_ERROR;
return -1;
}
memset(options, 0, sizeof(JavaVMOption));
diff --git a/src/modules/app_java/java_iface.c b/src/modules/app_java/java_iface.c
index 0535591055..74059331ac 100644
--- a/src/modules/app_java/java_iface.c
+++ b/src/modules/app_java/java_iface.c
@@ -152,9 +152,7 @@ int java_exec(struct sip_msg *msgp, int is_static, int
is_synchronized,
+ 1; // '(' + 'signature' + ')' + 'return signature' +
null terminator
cs = (char *)pkg_malloc((cslen+1) * sizeof(char));
if(!cs) {
- LM_ERR("%s: pkg_malloc() has failed. Can't allocate %lu bytes. Not "
- "enough memory!\n",
- APP_NAME, (unsigned long)cslen);
+ PKG_MEM_ERROR;
return -1;
}
r = snprintf(cs, cslen, "(%s)%s", signature, retval_sig);
diff --git a/src/modules/app_java/java_msgobj.c b/src/modules/app_java/java_msgobj.c
index cc5e1b4cce..940670f420 100644
--- a/src/modules/app_java/java_msgobj.c
+++ b/src/modules/app_java/java_msgobj.c
@@ -47,7 +47,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
SipMsgInstance = (jobject *)pkg_malloc(sizeof(jobject));
if(!SipMsgInstance) {
- LM_ERR("%s: pkg_malloc() has failed. Not enough memory!\n", APP_NAME);
+ PKG_MEM_ERROR;
return NULL;
}
memset(SipMsgInstance, 0, sizeof(jobject));
diff --git a/src/modules/app_java/java_native_methods.c
b/src/modules/app_java/java_native_methods.c
index 5d12e844cf..bb2ebe6be7 100644
--- a/src/modules/app_java/java_native_methods.c
+++ b/src/modules/app_java/java_native_methods.c
@@ -995,17 +995,13 @@ JNIEXPORT jint JNICALL
Java_org_siprouter_CoreMethods_force_1send_1socket(
nl = (struct name_lst *)pkg_malloc(sizeof(struct name_lst));
if(!nl) {
- LM_ERR("%s: force_send_socket: pkg_malloc() has failed. Not enough "
- "memory!\n",
- APP_NAME);
+ PKG_MEM_ERROR;
return -1;
}
si = (struct socket_id *)pkg_malloc(sizeof(struct socket_id));
if(!si) {
- LM_ERR("%s: force_send_socket: pkg_malloc() has failed. Not enough "
- "memory!\n",
- APP_NAME);
+ PKG_MEM_ERROR;
return -1;
}
diff --git a/src/modules/app_java/java_sig_parser.c
b/src/modules/app_java/java_sig_parser.c
index a1512fe85f..87b73b6288 100644
--- a/src/modules/app_java/java_sig_parser.c
+++ b/src/modules/app_java/java_sig_parser.c
@@ -188,7 +188,7 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
ret = (jvalue *)pkg_malloc(sizeof(jvalue));
if(!ret) {
- LM_ERR("%s: pkg_malloc() has failed. Not enouph memory!\n", APP_NAME);
+ PKG_MEM_ERROR;
return NULL;
}
diff --git a/src/modules/app_java/utils.c b/src/modules/app_java/utils.c
index 611665831e..5ec7cc17fe 100644
--- a/src/modules/app_java/utils.c
+++ b/src/modules/app_java/utils.c
@@ -46,7 +46,7 @@ char **split(char *str, char *sep)
buf = (char **)pkg_malloc(sizeof(char *));
if(!buf) {
- LM_ERR("%s: pkg_malloc() has failed. Not enough memory!\n", APP_NAME);
+ PKG_MEM_ERROR;
return NULL;
}
memset(&buf, 0, sizeof(char *));
@@ -69,8 +69,7 @@ char **split(char *str, char *sep)
buf = (char **)pkg_reallocxf(buf, (i + 2) * sizeof(char *));
if(!buf) {
- LM_ERR("%s: pkg_realloc() has failed. Not enough memory!\n",
- APP_NAME);
+ PKG_MEM_ERROR;
return NULL;
}
buf[i] = strdup(token);