From d2e023e3e5ef888e176292f149d1ba93ba270c94 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Sun, 11 Jan 2015 19:46:15 +0200 Subject: Bugfixes for oneof support. Fixes crashes / memory leaks when using pointer type fields. Also fixes initialization of which_oneof fields. --- pb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pb.h') diff --git a/pb.h b/pb.h index af58dca..fc846c9 100644 --- a/pb.h +++ b/pb.h @@ -514,7 +514,7 @@ struct pb_extension_s { #define PB_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \ {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \ fd, pb_delta(st, which_ ## u, u.m), \ - pb_membersize(st, u.m), 0, ptr} + pb_membersize(st, u.m[0]), 0, ptr} #define PB_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \ PB_ ## rules ## _ ## allocation(union_name, tag, message, field, \ -- cgit 1.2.3-korg