diff --git a/lib/include/srslte/common/buffer_pool.h b/lib/include/srslte/common/buffer_pool.h index 182c287e3..eec35b79a 100644 --- a/lib/include/srslte/common/buffer_pool.h +++ b/lib/include/srslte/common/buffer_pool.h @@ -76,7 +76,7 @@ public: { printf("%d buffers in queue\n", (int) used.size()); for (uint32_t i=0;idebug_name?used[i]->debug_name:"Undefined"); + printf("%s\n", strlen(used[i]->debug_name)?used[i]->debug_name:"Undefined"); } } @@ -97,7 +97,8 @@ public: } #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED if (debug_name) { - strncpy(b->debug_name, debug_name, 128); + strncpy(b->debug_name, debug_name, SRSLTE_BUFFER_POOL_LOG_NAME_LEN); + b->debug_name[SRSLTE_BUFFER_POOL_LOG_NAME_LEN-1] = 0; } #endif diff --git a/lib/include/srslte/common/common.h b/lib/include/srslte/common/common.h index d1f2f770f..5f13ab214 100644 --- a/lib/include/srslte/common/common.h +++ b/lib/include/srslte/common/common.h @@ -54,6 +54,7 @@ #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #define pool_allocate (pool->allocate(__FUNCTION__)) +#define SRSLTE_BUFFER_POOL_LOG_NAME_LEN 128 #else #define pool_allocate (pool->allocate()) #endif @@ -121,7 +122,7 @@ public: uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BYTES]; uint8_t *msg; #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED - char debug_name[128]; + char debug_name[SRSLTE_BUFFER_POOL_LOG_NAME_LEN]; #endif byte_buffer_t():N_bytes(0) @@ -129,6 +130,9 @@ public: timestamp_is_set = false; msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; next = NULL; +#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED + debug_name[0] = 0; +#endif } byte_buffer_t(const byte_buffer_t& buf) {