Module: kamailio
Branch: 5.4
Commit: f5c81022fdc769f306cf720bece29f1d265bfe61
URL:
https://github.com/kamailio/kamailio/commit/f5c81022fdc769f306cf720bece29f1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-07-29T10:49:56+02:00
core: pvapi - reinitialize _pv_print_buffer_index when adjusting the slots
- GH #2798
(cherry picked from commit 61cbb5e861aeb9b7f69ebb8d284e3ded0ede9cd8)
(cherry picked from commit 75571e1739470877365e7c25548ef282e81283a1)
---
Modified: src/core/pvapi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/f5c81022fdc769f306cf720bece29f1…
Patch:
https://github.com/kamailio/kamailio/commit/f5c81022fdc769f306cf720bece29f1…
---
diff --git a/src/core/pvapi.c b/src/core/pvapi.c
index 30b2a7cdfe..a018646e48 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();
}