[sysprof] libsysprof-capture: fix use of n_addrs



commit 0d6a3d0183c68cb85f66a9c72772dc64c6e82104
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 18 14:05:26 2020 -0800

    libsysprof-capture: fix use of n_addrs

 src/libsysprof-capture/sysprof-collector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/libsysprof-capture/sysprof-collector.c b/src/libsysprof-capture/sysprof-collector.c
index 8f31159..618da8f 100644
--- a/src/libsysprof-capture/sysprof-collector.c
+++ b/src/libsysprof-capture/sysprof-collector.c
@@ -398,6 +398,7 @@ sysprof_collector_allocate (SysprofCaptureAddress   alloc_addr,
         else
           n_addrs = 0;
 
+        ev->n_addrs = CLAMP (n_addrs, 0, MAX_UNWIND_DEPTH);
         ev->frame.len = sizeof *ev + sizeof (SysprofCaptureAddress) * ev->n_addrs;
         ev->frame.type = SYSPROF_CAPTURE_FRAME_ALLOCATION;
         ev->frame.cpu = _do_getcpu ();
@@ -406,7 +407,6 @@ sysprof_collector_allocate (SysprofCaptureAddress   alloc_addr,
         ev->tid = collector->tid;
         ev->alloc_addr = alloc_addr;
         ev->alloc_size = alloc_size;
-        ev->n_addrs = CLAMP (n_addrs, 0, MAX_UNWIND_DEPTH);
 
         mapped_ring_buffer_advance (collector->buffer, ev->frame.len);
       }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]