[PATCH 02/14] Cleanup: avoid memory leaks

Dirk Hohndel dirk at hohndel.org
Wed Jan 3 11:35:05 PST 2018


Coverity CID 207730
Coverity CID 207747

Signed-off-by: Dirk Hohndel <dirk at hohndel.org>
---
 src/suunto_eonsteel_parser.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/suunto_eonsteel_parser.c b/src/suunto_eonsteel_parser.c
index 7a64e5026c9c..ffdd172d367f 100644
--- a/src/suunto_eonsteel_parser.c
+++ b/src/suunto_eonsteel_parser.c
@@ -776,10 +776,12 @@ static void sample_setpoint_type(const struct type_desc *desc, struct sample_dat
 		sample.ppo2 = info->eon->cache.customsetpoint;
 	else {
 		DEBUG(info->eon->base.context, "sample_setpoint_type(%u) unknown type '%s'", value, type);
+		free((void *)type);
 		return;
 	}
 
 	if (info->callback) info->callback(DC_SAMPLE_SETPOINT, sample, info->userdata);
+	free((void *)type);
 }
 
 // uint32
@@ -1125,6 +1127,7 @@ static int add_gas_type(suunto_eonsteel_parser_t *eon, const struct type_desc *d
 
 	eon->cache.initialized |= 1 << DC_FIELD_GASMIX_COUNT;
 	eon->cache.initialized |= 1 << DC_FIELD_TANK_COUNT;
+	free((void *)name);
 	return 0;
 }
 
-- 
2.15.1



More information about the devel mailing list