From 202505fd734a89eb0e2e84603a2a6c2eb43d2cb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beat=20K=C3=BCng?= <beat-kueng@gmx.net>
Date: Mon, 23 Apr 2018 15:41:03 +0200
Subject: [PATCH] mixer_multirotor: fix initialization of _outputs_prev

memset (http://www.cplusplus.com/reference/cstring/memset/) interprets
the value argument as unsigned char, so passing a float will not work.
---
 src/lib/mixer/mixer_multirotor.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lib/mixer/mixer_multirotor.cpp b/src/lib/mixer/mixer_multirotor.cpp
index b51c6d81b7..3b654256fb 100644
--- a/src/lib/mixer/mixer_multirotor.cpp
+++ b/src/lib/mixer/mixer_multirotor.cpp
@@ -1,6 +1,6 @@
 /****************************************************************************
  *
- *   Copyright (c) 2012-2016 PX4 Development Team. All rights reserved.
+ *   Copyright (c) 2012-2018 PX4 Development Team. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -76,7 +76,9 @@ MultirotorMixer::MultirotorMixer(ControlCallback control_cb,
 	_rotors(_config_index[(MultirotorGeometryUnderlyingType)geometry]),
 	_outputs_prev(new float[_rotor_count])
 {
-	memset(_outputs_prev, _idle_speed, _rotor_count * sizeof(float));
+	for (unsigned i = 0; i < _rotor_count; ++i) {
+		_outputs_prev[i] = _idle_speed;
+	}
 }
 
 MultirotorMixer::~MultirotorMixer()
-- 
GitLab