[sr-dev] git:master:b5c40df3: acc: use mem error macros

Victor Seva linuxmaniac at torreviejawireless.org
Fri Dec 28 15:30:33 CET 2018


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

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2018-12-28T13:52:56+01:00

acc: use mem error macros

---

Modified: src/modules/acc/acc_extra.c
Modified: src/modules/acc/acc_mod.c

---

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

---

diff --git a/src/modules/acc/acc_extra.c b/src/modules/acc/acc_extra.c
index c92995beaf..5e8568535e 100644
--- a/src/modules/acc/acc_extra.c
+++ b/src/modules/acc/acc_extra.c
@@ -115,7 +115,7 @@ struct acc_extra *parse_acc_extra(char *extra_str)
 		}
 		extra = (struct acc_extra*)pkg_malloc(sizeof(struct acc_extra));
 		if (extra==0) {
-			LM_ERR("no more pkg mem 1\n");
+			PKG_MEM_ERROR;
 			goto error;
 		}
 		memset( extra, 0, sizeof(struct acc_extra));
@@ -237,7 +237,7 @@ int extra2strar(struct acc_extra *extra, struct sip_msg *rq, str *val_arr,
 		} else {
 			val_arr[n].s = (char *)pkg_malloc(value.rs.len);
 			if (val_arr[n].s == NULL ) {
-				LM_ERR("out of memory.\n");
+				PKG_MEM_ERROR;
 				/* Cleanup already allocated memory and
 				 * return that we didn't do anything */
 				for (i = 0; i < n ; i++) {
diff --git a/src/modules/acc/acc_mod.c b/src/modules/acc/acc_mod.c
index cde32146b9..a4f9a64265 100644
--- a/src/modules/acc/acc_mod.c
+++ b/src/modules/acc/acc_mod.c
@@ -165,7 +165,7 @@ static int _acc_module_initialized = 0;
 static int acc_fixup(void** param, int param_no);
 static int free_acc_fixup(void** param, int param_no);
 
-
+/* clang-format off */
 static cmd_export_t cmds[] = {
 	{"acc_log_request", (cmd_function)w_acc_log_request, 1,
 		acc_fixup, free_acc_fixup,
@@ -242,14 +242,14 @@ struct module_exports exports= {
 	DEFAULT_DLFLAGS, /* dlopen flags */
 	cmds,            /* exported functions */
 	params,     	 /* exported params */
-        0,          	 /* RPC method exports */
+	0,          	 /* RPC method exports */
 	0,          	 /* exported pseudo-variables */
 	0,          	 /* response function */
 	mod_init,   	 /* initialization module */
 	child_init,  	 /* per-child init function */
 	destroy    	 /* destroy function */
 };
-
+/* clang-format on */
 
 
 /************************** FIXUP functions ****************************/
@@ -268,7 +268,7 @@ static int acc_fixup(void** param, int param_no)
 	if (param_no == 1) {
 		accp = (struct acc_param*)pkg_malloc(sizeof(struct acc_param));
 		if (!accp) {
-			LM_ERR("no more pkg mem\n");
+			PKG_MEM_ERROR;
 			return E_OUT_OF_MEM;
 		}
 		memset( accp, 0, sizeof(struct acc_param));
@@ -664,7 +664,7 @@ static int acc_register_engine(acc_engine_t *eng)
 	e = (acc_engine_t*)pkg_malloc(sizeof(acc_engine_t));
 	if(e ==NULL)
 	{
-		LM_ERR("no more pkg\n");
+		PKG_MEM_ERROR;
 		return -1;
 	}
 	memcpy(e, eng, sizeof(acc_engine_t));




More information about the sr-dev mailing list