From 0d6bb583c2d521b5754bb83036d0b12a28e72384 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Fri, 3 May 2013 17:23:18 +0200 Subject: [PATCH] add missing initialization (thanks to valgrind) --- mbus/mbus-protocol-aux.c | 8 ++++++-- mbus/mbus-protocol.c | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mbus/mbus-protocol-aux.c b/mbus/mbus-protocol-aux.c index 08e5d8c..feae7d8 100755 --- a/mbus/mbus-protocol-aux.c +++ b/mbus/mbus-protocol-aux.c @@ -1584,6 +1584,8 @@ int mbus_purge_frames(mbus_handle *handle) { int err, received; mbus_frame reply; + + memset((void *)&reply, 0, sizeof(mbus_frame)); received = 0; while (1) @@ -2033,7 +2035,8 @@ mbus_select_secondary_address(mbus_handle * handle, const char *mask) mbus_error_str()); return MBUS_PROBE_ERROR; } - + + memset((void *)&reply, 0, sizeof(mbus_frame)); ret = mbus_recv_frame(handle, &reply); if (ret == MBUS_RECV_RESULT_TIMEOUT) @@ -2093,7 +2096,8 @@ mbus_probe_secondary_address(mbus_handle * handle, const char *mask, char *match mbus_error_str()); return MBUS_PROBE_ERROR; } - + + memset((void *)&reply, 0, sizeof(mbus_frame)); ret = mbus_recv_frame(handle, &reply); if (ret == MBUS_RECV_RESULT_TIMEOUT) diff --git a/mbus/mbus-protocol.c b/mbus/mbus-protocol.c index b7d16f7..834f445 100755 --- a/mbus/mbus-protocol.c +++ b/mbus/mbus-protocol.c @@ -3703,6 +3703,8 @@ mbus_frame_xml(mbus_frame *frame) if (frame) { + memset((void *)&frame_data, 0, sizeof(mbus_frame_data)); + if (mbus_frame_data_parse(frame, &frame_data) == -1) { mbus_error_str_set("M-bus data parse error.");