]> git.proxmox.com Git - mirror_lxc.git/commit
When an item is added to an array, then the array is realloc()ed (to size+1),
authorTomasz Blaszczak <tomasz.blaszczak@consult.red>
Wed, 23 Jun 2021 07:17:05 +0000 (09:17 +0200)
committerTomasz Blaszczak <tomasz.blaszczak@consult.red>
Wed, 23 Jun 2021 08:41:39 +0000 (10:41 +0200)
commitfe444ea6bcfe65d58a4dc0bef0db0c3372ed12a5
tree06640f658d9fde13b01a9cdde1a6cdf5a99f91c1
parent2ccc8081d2f37b34523cd95ec19aece6b006caad
When an item is added to an array, then the array is realloc()ed (to size+1),
and the item is copied (strdup()) to the array.
Thus, when an item is removed from an array, memory allocated for that item
should be freed, successive items should be left-shifted and the array
realloc()ed again (size-1).

Additional changes:
- If strdup() fails in add_to_array(), then an array should be
  realloc()ed again to original size.
- Initialize an array in list_all_containers().

Signed-off-by: Tomasz Blaszczak <tomasz.blaszczak@consult.red>
src/lxc/lxccontainer.c