[SR-Users] out of memory Error

Daniel-Constantin Mierla miconda at gmail.com
Thu Oct 1 08:25:01 CEST 2015


Hello,

ok, so the issue was in acc_radius module.

Can you make a pull request with this patch via github project:

  - https://github.com/kamailio/kamailio/pulls

Cheers,
Daniel

On 30/09/15 15:59, ycaner wrote:
> Hello Daniel ;
>
> After changes some codes , it is solved. Here is diff for checking.
>
> diff --git a/modules/acc_radius/acc_radius_mod.c
> b/modules/acc_radius/acc_radius_mod.c
> index b1843d6..2bc0acc 100644
> --- a/modules/acc_radius/acc_radius_mod.c
> +++ b/modules/acc_radius/acc_radius_mod.c
> @@ -49,6 +49,7 @@
>  #include "../../lib/kcore/radius.h"
>  #include "../../modules/acc/acc_api.h"
>  #include "acc_radius_mod.h"
> +#include "../../modules/acc/acc_extra.h"
>
>  MODULE_VERSION
>
> @@ -329,6 +330,8 @@ int acc_radius_send_request(struct sip_msg *req,
> acc_info_t *inf)
>         uint32_t av_type;
>         int offset;
>         int i;
> +        int m=0;
> +        int o=0;
>
>         send=NULL;
>
> @@ -353,8 +356,11 @@ int acc_radius_send_request(struct sip_msg *req,
> acc_info_t *inf)
>         ADD_RAD_AVPAIR( RA_TIME_STAMP, &av_type, -1);
>
>         /* add extra also */
> -       attr_cnt += accb.get_extra_attrs(rad_extra, req, inf->varr+attr_cnt,
> -                               inf->iarr+attr_cnt, inf->tarr+attr_cnt);
> +       o = accb.get_extra_attrs(rad_extra, req, inf->varr+attr_cnt,
> +                                inf->iarr+attr_cnt, inf->tarr+attr_cnt);
> +
> +        attr_cnt += o;
> +        m = attr_cnt;
>
>         /* add the values for the vector - start from 1 instead of
>          * 0 to skip the first value which is the METHOD as string */
> @@ -388,10 +394,14 @@ int acc_radius_send_request(struct sip_msg *req,
> acc_info_t *inf)
>                 goto error;
>         }
>         rc_avpair_free(send);
> +       /*dont forget free memory allocated by extra2strar */
> +        free_strar_mem( &(inf->tarr[m-o]), &(inf->varr[m-o]), o, m);
>         return 1;
>
>  error:
>         rc_avpair_free(send);
> +        /* free memory allocated by extra2strar */
> +        free_strar_mem( &(inf->tarr[m-o]), &(inf->varr[m-o]), o, m);
>         return -1;
>  }
>
>
>
>
>
>
> --
> View this message in context: http://sip-router.1086192.n5.nabble.com/out-of-memory-Error-tp141866p141948.html
> Sent from the Users mailing list archive at Nabble.com.
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - http://asipto.com/u/kat




More information about the sr-users mailing list