Fix: define _LGPL_SOURCE in C files
[lttng-tools.git] / src / common / compat / compat-poll.c
index 79fcb7d652b87230815c4d7b6d7146cf8546a9c2..32932448dfdb6816e372546788bc393ed917f924 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <assert.h>
 #include <stdlib.h>
 #include <sys/resource.h>
@@ -52,6 +53,11 @@ static int resize_poll_event(struct compat_poll_event_array *array,
                PERROR("realloc epoll add");
                goto error;
        }
+       if (new_size > array->alloc_size) {
+               /* Zero newly allocated memory */
+               memset(ptr + array->alloc_size, 0,
+                       (new_size - array->alloc_size) * sizeof(*ptr));
+       }
        array->events = ptr;
        array->alloc_size = new_size;
 
This page took 0.023703 seconds and 4 git commands to generate.