Module: kamailio
Branch: 5.5
Commit: 75571e1739470877365e7c25548ef282e81283a1
URL:
https://github.com/kamailio/kamailio/commit/75571e1739470877365e7c25548ef28…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)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/75571e1739470877365e7c25548ef28…
Patch:
https://github.com/kamailio/kamailio/commit/75571e1739470877365e7c25548ef28…
---
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();
}