Skip to content

Commit

Permalink
acc: use mem error macros
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxmaniac committed Dec 28, 2018
1 parent 851fe7f commit b5c40df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/modules/acc/acc_extra.c
Expand Up @@ -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));
Expand Down Expand Up @@ -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++) {
Expand Down
10 changes: 5 additions & 5 deletions src/modules/acc/acc_mod.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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 ****************************/
Expand All @@ -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));
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit b5c40df

Please sign in to comment.