AP_HAL_Linux: use OwnPtr for _device in UARTDriver
Otherwise we're going to leak memory without any need. Before this fix we've created ConsoleDevice 4 times in case -A switch hadn't been supplied, but we hadn't ever deleted those. Now there's no memory leak here.
This commit is contained in:
parent
3f1e999fc8
commit
897d2fb1fb
@ -1,7 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "AP_HAL_Linux.h"
|
#include <AP_HAL/utility/OwnPtr.h>
|
||||||
|
|
||||||
|
#include "AP_HAL_Linux.h"
|
||||||
#include "SerialDevice.h"
|
#include "SerialDevice.h"
|
||||||
|
|
||||||
class Linux::UARTDriver : public AP_HAL::UARTDriver {
|
class Linux::UARTDriver : public AP_HAL::UARTDriver {
|
||||||
@ -38,7 +39,7 @@ public:
|
|||||||
enum flow_control get_flow_control(void) { return _flow_control; }
|
enum flow_control get_flow_control(void) { return _flow_control; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SerialDevice *_device = nullptr;
|
AP_HAL::OwnPtr<SerialDevice> _device;
|
||||||
bool _nonblocking_writes;
|
bool _nonblocking_writes;
|
||||||
bool _console;
|
bool _console;
|
||||||
volatile bool _in_timer;
|
volatile bool _in_timer;
|
||||||
|
Loading…
Reference in New Issue
Block a user