fix memory leaks in error case

This commit is contained in:
Stefan Wahren 2013-07-03 20:34:30 +02:00
parent 8dd1d4e4ae
commit 551176911f

View File

@ -4047,11 +4047,13 @@ mbus_frame_get_secondary_address(mbus_frame *frame)
if (frame->control_information != MBUS_CONTROL_INFO_RESP_VARIABLE) if (frame->control_information != MBUS_CONTROL_INFO_RESP_VARIABLE)
{ {
snprintf(error_str, sizeof(error_str), "Non-variable data response (can't get secondary address from response)."); snprintf(error_str, sizeof(error_str), "Non-variable data response (can't get secondary address from response).");
mbus_frame_data_free(data);
return NULL; return NULL;
} }
if (mbus_frame_data_parse(frame, data) == -1) if (mbus_frame_data_parse(frame, data) == -1)
{ {
mbus_frame_data_free(data);
return NULL; return NULL;
} }