From: Jérémie Galarneau Date: Tue, 17 Oct 2017 03:48:21 +0000 (-0400) Subject: Fix: dynamic buffer mishandles setting capacity to 0 X-Git-Tag: v2.11.0-rc1~95 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e9347dad290bd17c81846a6c9dda6e9bc05ead5b;p=lttng-tools.git Fix: dynamic buffer mishandles setting capacity to 0 Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/dynamic-buffer.c b/src/common/dynamic-buffer.c index 2e27afa1f..cec2f1e60 100644 --- a/src/common/dynamic-buffer.c +++ b/src/common/dynamic-buffer.c @@ -148,7 +148,8 @@ int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer, { int ret = 0; void *new_buf; - size_t new_capacity = round_to_power_of_2(demanded_capacity); + size_t new_capacity = demanded_capacity ? + round_to_power_of_2(demanded_capacity) : 0; if (!buffer || demanded_capacity < buffer->size) { /*