summaryrefslogtreecommitdiff
path: root/sys/src/cmd/dtracy
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2022-08-13 22:12:20 +0000
committerOri Bernstein <ori@eigenstate.org>2022-08-13 22:12:20 +0000
commitf332cf05579e82b213944a331c7b4f37f88f2587 (patch)
tree3974077f6dfccf16d1ab1f6cdfb973b821dfade8 /sys/src/cmd/dtracy
parent60f9467c011394d8ebeebed15733ebd0b58a10d0 (diff)
dtracy: correctly look up aggregate keys
the ANode struct contains a variable sized buffer for the key, however when we created and copied the aggregate, we used struct assignment to initialize the node. the struct assignment only knows about the fixed size portion of the struct, and did not copy the key, which mean that key lookups would fail, and we would insert a new value into the aggregation every time, both leaking the memory and producng incorrect results.
Diffstat (limited to 'sys/src/cmd/dtracy')
-rw-r--r--sys/src/cmd/dtracy/agg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/src/cmd/dtracy/agg.c b/sys/src/cmd/dtracy/agg.c
index c54636479..d29f96e19 100644
--- a/sys/src/cmd/dtracy/agg.c
+++ b/sys/src/cmd/dtracy/agg.c
@@ -93,7 +93,7 @@ aggparsebuf(uchar *p, int n)
np = (ANode *) avllookup(tp, key, 0);
if(np == nil){
np = emalloc(sizeof(ANode) - 1 + a->keysize);
- *np = *key;
+ memcpy(np, key, sizeof(ANode) - 1 + a->keysize);
createrecord(a->type, np, (s64int*)&p[8+a->keysize]);
avlinsert(tp, np);
}else