this patch adds several missing frees in cgsnapshot tool
Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
if ((buf[i] == '#') || (buf[i] == '\0'))
continue;
+ ret = sscanf(buf, "%s", name);
+ if (ret == 0)
+ continue;
+
new = (struct black_list_type *)malloc(sizeof
(struct black_list_type));
if (new == NULL) {
goto err;
}
- ret = sscanf(buf, "%s", name);
- if (ret == 0)
- continue;
-
new->name = strdup(name);
if (new->name == NULL) {
fprintf(stderr, "ERROR: Memory allocation problem "
"(%s)\n", strerror(errno));
ret = 1;
+ free(new);
goto err;
}
new->next = NULL;
}
}
- fclose(fw);
*p_list = start;
return 0;
err:
+ fclose(fw);
new = start;
while (new != NULL) {
end = new->next;