From: Jérémie Galarneau Date: Wed, 10 Jun 2020 17:02:29 +0000 (-0400) Subject: common: set dynamic-buffer's data to NULL on reset() X-Git-Tag: v2.13.0-rc1~620 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=427d84693052f551da11a175d9a0f74bb6e169b3;p=lttng-tools.git common: set dynamic-buffer's data to NULL on reset() Set 'data' to NULL after the reset of a dynamic_buffer since re-using it (e.g. appending) will cause realloc to be called with an invalid pointer. Not marked as a fix as no code currently re-uses a buffer after a reset(). Signed-off-by: Jérémie Galarneau Change-Id: I58fd5bbcfcda9d952748bea17430e2f41b076f3c --- diff --git a/src/common/dynamic-buffer.c b/src/common/dynamic-buffer.c index 26d318dcd..4e87c58ac 100644 --- a/src/common/dynamic-buffer.c +++ b/src/common/dynamic-buffer.c @@ -186,6 +186,7 @@ void lttng_dynamic_buffer_reset(struct lttng_dynamic_buffer *buffer) buffer->size = 0; buffer->_capacity = 0; free(buffer->data); + buffer->data = NULL; } LTTNG_HIDDEN