Module: kamailio
Branch: master
Commit: 61cbb5e861aeb9b7f69ebb8d284e3ded0ede9cd8
URL:
https://github.com/kamailio/kamailio/commit/61cbb5e861aeb9b7f69ebb8d284e3de…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-07-27T16:52:12+02:00
core: pvapi - reinitialize _pv_print_buffer_index when adjusting the slots
- GH #2798
---
Modified: src/core/pvapi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/61cbb5e861aeb9b7f69ebb8d284e3de…
Patch:
https://github.com/kamailio/kamailio/commit/61cbb5e861aeb9b7f69ebb8d284e3de…
---
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();
}