diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2015-03-07 10:25:09 +0200 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2015-03-07 10:25:09 +0200 |
commit | ef422656a57b3f472b192691a40f48d0d72f2927 (patch) | |
tree | d6337dc04ed820deda96279ee00e3eb3d2e7775c /tests | |
parent | 5c16a116ec2db9d19e42c5682cbfbf4f2b87ad87 (diff) |
Fix oneof submessage initialization bug.
Update issue 149
Status: FixedInGit
Diffstat (limited to 'tests')
-rw-r--r-- | tests/oneof/decode_oneof.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/oneof/decode_oneof.c b/tests/oneof/decode_oneof.c index 83b4702c..37075cd6 100644 --- a/tests/oneof/decode_oneof.c +++ b/tests/oneof/decode_oneof.c @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <pb_decode.h> #include "oneof.pb.h" #include "test_helpers.h" @@ -10,9 +11,12 @@ /* Test the 'OneOfMessage' */ int test_oneof_1(pb_istream_t *stream, int option) { - OneOfMessage msg = OneOfMessage_init_zero; + OneOfMessage msg; int status = 0; + /* To better catch initialization errors */ + memset(&msg, 0xAA, sizeof(msg)); + if (!pb_decode(stream, OneOfMessage_fields, &msg)) { printf("Decoding failed: %s\n", PB_GET_ERROR(stream)); @@ -124,4 +128,4 @@ int main(int argc, char **argv) } return 0; -}
\ No newline at end of file +} |