Browse code

acc_json: update to free cdr core attrs

(cherry picked from commit f7b35f05f31bd7cc01aea4572c79ba48d84d8123)

Daniel-Constantin Mierla authored on 19/09/2022 06:40:19
Showing 1 changed files
... ...
@@ -452,14 +452,13 @@ int cdr_json_write(struct dlg_cell *dlg, struct sip_msg *req, cdr_info_t *inf)
452 452
 				inf->tarr + attr_cnt);
453 453
 		attr_cnt += extra_cnt;
454 454
 	} else if (cdr_expired_dlg_enable){
455
-		int dlg_index = 0;
456
-		dlg_index += accb.get_extra_dlg_attrs( cdr_extra,
455
+		extra_cnt += accb.get_extra_dlg_attrs( cdr_extra,
457 456
 				dlg,
458 457
 				inf->varr + attr_cnt,
459 458
 				inf->iarr + attr_cnt,
460 459
 				inf->tarr + attr_cnt,
461 460
 				&dlgb);
462
-		attr_cnt += dlg_index;
461
+		attr_cnt += extra_cnt;
463 462
 	}
464 463
 
465 464
 	struct acc_extra *extra = cdr_extra;
... ...
@@ -516,7 +515,7 @@ int cdr_json_write(struct dlg_cell *dlg, struct sip_msg *req, cdr_info_t *inf)
516 515
 		json_object_clear(object);
517 516
 		json_decref(object);
518 517
 	}
519
-	/* free memory allocated by get_extra_attrs */
520
-	free_strar_mem(&(inf->tarr[core_cnt]), &(inf->varr[core_cnt]), extra_cnt, attr_cnt);
518
+	/* free memory allocated by cdr core+extra attrs */
519
+	free_strar_mem(&(inf->tarr[0]), &(inf->varr[0]), attr_cnt, attr_cnt);
521 520
 	return 1;
522 521
 }