Commit debfa8b6 by Serge Hallyn Committed by Stéphane Graber

cppcheck: fix unchecked realloc in lxc_info.c

parent ebd30892
...@@ -50,9 +50,13 @@ static int filter_count = 0; ...@@ -50,9 +50,13 @@ static int filter_count = 0;
static int my_parser(struct lxc_arguments* args, int c, char* arg) static int my_parser(struct lxc_arguments* args, int c, char* arg)
{ {
char **newk;
switch (c) { switch (c) {
case 'c': case 'c':
key = realloc(key, keys+1 * sizeof(key[0])); newk = realloc(key, keys+1 * sizeof(key[0]));
if (!newk)
return -1;
key = newk;
key[keys] = arg; key[keys] = arg;
keys++; keys++;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment