Shoutout to scan-build for finding this one!
state->values = calloc(sizeof(*state->values), state->values_len);
state->values_types = calloc(sizeof(*state->values_types), state->values_len);
if ((state->values == NULL) || (state->values_types == NULL)) {
- free(state->values);
- free(state->values_types);
return ENOMEM;
}
case TYPE_VALUES: {
lcc_value_list_t vl = state;
if (parse_values(payload, sizeof(payload), &vl)) {
+ free(vl.values);
+ free(vl.values_types);
DEBUG("lcc_network_parse(): parse_values failed.\n");
return EINVAL;
}