File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -110,15 +110,17 @@ bool VS2::write(const Datapoint& datapoint, const VariantValue& value) {
110
110
}
111
111
uint8_t * payload = reinterpret_cast <uint8_t *>(malloc (datapoint.length ()));
112
112
if (!payload) return false ;
113
- _currentDatapoint.encode (payload, _currentDatapoint.length (), value);
114
- return write (datapoint, payload, _currentDatapoint.length ());
113
+ datapoint.encode (payload, datapoint.length (), value);
114
+ bool result = write (datapoint, payload, datapoint.length ());
115
+ free (payload);
116
+ return result;
115
117
}
116
118
117
119
bool VS2::write (const Datapoint& datapoint, const uint8_t * data, uint8_t length) {
118
120
if (_currentDatapoint) {
119
121
return false ;
120
122
}
121
- if (length != _currentDatapoint .length ()) {
123
+ if (length != datapoint .length ()) {
122
124
vw_log_i (" writing not possible, length error" );
123
125
return false ;
124
126
}
You can’t perform that action at this time.
0 commit comments