fix use of uninitialized struct ip_range

This commit is contained in:
Tilka 2012-04-21 09:46:50 +02:00
parent c5036a3ff8
commit 27ceb7ad33

View File

@ -108,6 +108,9 @@ void hub_command_args_free(struct hub_command* cmd)
case type_string: case type_string:
hub_free(data->data.string); hub_free(data->data.string);
break; break;
case type_range:
hub_free(data->data.range);
break;
default: default:
break; break;
} }
@ -241,8 +244,10 @@ static enum command_parse_status command_extract_arguments(struct command_base*
case 'r': case 'r':
data = hub_malloc(sizeof(*data)); data = hub_malloc(sizeof(*data));
data->type = type_range; data->type = type_range;
data->data.range = hub_malloc_zero(sizeof(struct ip_range));
if (!ip_convert_address_to_range(token, data->data.range)) if (!ip_convert_address_to_range(token, data->data.range))
{ {
hub_free(data->data.range);
hub_free(data); hub_free(data);
data = NULL; data = NULL;
status = cmd_status_arg_address; status = cmd_status_arg_address;