Fix realloc invalid next size
authorDavid Goulet <david.goulet@polymtl.ca>
Wed, 30 Nov 2011 16:30:14 +0000 (11:30 -0500)
committerDavid Goulet <david.goulet@polymtl.ca>
Wed, 30 Nov 2011 16:30:16 +0000 (11:30 -0500)
Reported-by: Tan Dung Le Tran <tan.dung.le.tran@ericsson.com>
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
lttng-sessiond/kernel.c
lttng-sessiond/ust-app.c

index c734e889bb9cd25e808d8d5cd83d39b73f367395..16334a83b26122b4096ddf9dc71c473095549867 100644 (file)
@@ -582,7 +582,7 @@ ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
                                        nbmem + KERNEL_EVENT_LIST_SIZE);
                        /* Adding the default size again */
                        nbmem += KERNEL_EVENT_LIST_SIZE;
-                       elist = realloc(elist, nbmem);
+                       elist = realloc(elist, nbmem * sizeof(struct lttng_event));
                        if (elist == NULL) {
                                perror("realloc list events");
                                count = -ENOMEM;
index 0472251434dbb8fb1953ceda2777ce7a46412adb..1afb6d199db7bbda66e52979742e93d2a33a4cb9 100644 (file)
@@ -1185,7 +1185,7 @@ int ust_app_list_events(struct lttng_event **events)
                                DBG2("Reallocating event list from %zu to %zu bytes", nbmem,
                                                nbmem + UST_APP_EVENT_LIST_SIZE);
                                nbmem += UST_APP_EVENT_LIST_SIZE;
-                               tmp = realloc(tmp, nbmem);
+                               tmp = realloc(tmp, nbmem * sizeof(struct lttng_event));
                                if (tmp == NULL) {
                                        PERROR("realloc ust app events");
                                        ret = -ENOMEM;
This page took 0.035567 seconds and 4 git commands to generate.