Fix: dynamic buffer mishandles setting capacity to 0
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 Oct 2017 03:48:21 +0000 (23:48 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 24 Aug 2018 19:27:34 +0000 (15:27 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/dynamic-buffer.c

index 2e27afa1f92f446c12de25a0f268f6de33623536..cec2f1e608a67d1e0a148c491c8a8015ce5f27dc 100644 (file)
@@ -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) {
                /*
This page took 0.02633 seconds and 5 git commands to generate.