From 785ad0614a2ba6d3bdd3469efb12db04ddddc7ba Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 26 Apr 2016 16:46:06 +1000 Subject: [PATCH] SITL: fixed coverity 125055 --- libraries/SITL/SIM_Aircraft.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/SITL/SIM_Aircraft.cpp b/libraries/SITL/SIM_Aircraft.cpp index 24ab70faa8..41333236de 100644 --- a/libraries/SITL/SIM_Aircraft.cpp +++ b/libraries/SITL/SIM_Aircraft.cpp @@ -80,18 +80,22 @@ bool Aircraft::parse_home(const char *home_str, Location &loc, float &yaw_degree } char *lat_s = strtok_r(s, ",", &saveptr); if (!lat_s) { + free(s); return false; } char *lon_s = strtok_r(NULL, ",", &saveptr); if (!lon_s) { + free(s); return false; } char *alt_s = strtok_r(NULL, ",", &saveptr); if (!alt_s) { + free(s); return false; } char *yaw_s = strtok_r(NULL, ",", &saveptr); if (!yaw_s) { + free(s); return false; }