[sr-dev] git:5.5:75571e17: core: pvapi - reinitialize _pv_print_buffer_index when adjusting the slots

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 29 10:41:14 CEST 2021


Module: kamailio
Branch: 5.5
Commit: 75571e1739470877365e7c25548ef282e81283a1
URL: https://github.com/kamailio/kamailio/commit/75571e1739470877365e7c25548ef282e81283a1

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-07-29T10:40:38+02:00

core: pvapi - reinitialize _pv_print_buffer_index when adjusting the slots

- GH #2798

(cherry picked from commit 61cbb5e861aeb9b7f69ebb8d284e3ded0ede9cd8)

---

Modified: src/core/pvapi.c

---

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

---

diff --git a/src/core/pvapi.c b/src/core/pvapi.c
index 5fc2952ed9..a87c91756c 100644
--- a/src/core/pvapi.c
+++ b/src/core/pvapi.c
@@ -2147,6 +2147,7 @@ int pv_init_buffer(void)
 			_pv_print_buffer_slots, _pv_print_buffer_size);
 	_pv_print_buffer_slots_active = _pv_print_buffer_slots;
 	_pv_print_buffer_size_active = _pv_print_buffer_size;
+	_pv_print_buffer_index = 0;
 
 	return 0;
 }
@@ -2168,6 +2169,7 @@ void pv_destroy_buffer(void)
 	pkg_free(_pv_print_buffer);
 	_pv_print_buffer_slots_active = 0;
 	_pv_print_buffer_size_active = 0;
+	_pv_print_buffer_index = 0;
 	_pv_print_buffer = NULL;
 }
 
@@ -2177,8 +2179,9 @@ void pv_destroy_buffer(void)
 int pv_reinit_buffer(void)
 {
 	if(_pv_print_buffer_size==_pv_print_buffer_size_active
-			&& _pv_print_buffer_slots==_pv_print_buffer_slots_active)
+			&& _pv_print_buffer_slots==_pv_print_buffer_slots_active) {
 		return 0;
+	}
 	pv_destroy_buffer();
 	return pv_init_buffer();
 }




More information about the sr-dev mailing list