[SR-Users] out of memory Error

ycaner yasin.caner at netgsm.com.tr
Wed Sep 30 15:59:03 CEST 2015


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.



More information about the sr-users mailing list