Fix: miscellaneous memory handling fixes
[lttng-tools.git] / src / common / compat / compat-poll.c
index 79fcb7d652b87230815c4d7b6d7146cf8546a9c2..4893768a098543815207c90283eb9591d97a3a4a 100644 (file)
@@ -52,6 +52,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.022754 seconds and 4 git commands to generate.