Cleanup: avoid memory leaks

Coverity CID 207730
Coverity CID 207747

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-12-28 08:21:47 -08:00
parent ca3466e79c
commit ee1699177a

View File

@ -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;
}