proc_parse: allocate memory for the terminating null of the string

CID 996207 (#1 of 1): Out-of-bounds access (OVERRUN)
5. alloc_strlen: Allocating insufficient memory for the terminating null of the string.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr-check: don't forget close a test socket

CID 996206 (#3 of 3): Resource leak (RESOURCE_LEAK)
8. leaked_handle: Handle variable "sk" going out of scope leaks the handle.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr-dump: move core_entry_free closer to core_entry_alloc

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr-dump: core_entry_free should free core

CID 996205 (#1-2 of 2): Resource leak (RESOURCE_LEAK)
14. leaked_storage: Variable "core" going out of scope leaks the storage it points to.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr-dump: fix memory leak in fill_zombies_pids

CID 996204 (#1 of 1): Resource leak (RESOURCE_LEAK)
11. leaked_storage: Variable "ch" going out of scope leaks the storage it points to.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr-restore: fix error handling and memory leak in read_vma

CID 996203 (#1 of 1): Resource leak (RESOURCE_LEAK)
15. leaked_storage: Variable "vma" going out of scope leaks the storage it points to.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files-reg: don't forget to close fd in case of error

CID 996201 (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_handle: Handle variable "fd" going out of scope leaks the handle.

CID 996202 (#1 of 1): Resource leak (RESOURCE_LEAK)
6. leaked_handle: Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
page-pipe: fix memory leak on error path

CID 996197 (#1 of 1): Resource leak (RESOURCE_LEAK)
8. leaked_storage: Variable ppb going out of scope leaks the storage it points to.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
namespaces: close fd on the source netns in restore_ns

It's opened in switch_ns.

CID 996194 (#3 of 5): Resource leak (RESOURCE_LEAK)
11. leaked_handle: Handle variable rst going out of scope leaks the handle.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
sysctl: Don't forget to close fds

In case if openat/open call returned fd = 0,
don't forget to close it on routine exit,
ie just use close_safe macro.

Not a big deal since the descriptors get closed
once program finish execution but still.

#CID 996183 Resource leak

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
tools

Signed-off-by: Andrey Vagin <avagin@openvz.org>
newpidns
zdtm: print an error message and exit if exec failed
zdtm: don't create loops of bind mounts

Before this patch crtools/test is bound to crtools/test/dump/crtools.XXXXXXX

It's a main reason why sometimes "make clean" deletes all content
from crtools/test.
cr-dump: collect mount points in the target namespace

Information about mount points is used for dumping fanotify.
zdtm: add fanotify00 in the default list
parasite: fix error paths in parasite_init

* Call restore_ns on error paths.
* Use close_safe for the socket, because it can be reused

CID 996194 (#1 of 3): Resource leak (RESOURCE_LEAK)
6. leaked_handle: Handle variable "rst" going out of scope leaks the
handle.
mount: free all parts of mnt entries

mnt_entry contains a few strings and they should be release too

CID 996198 (#4 of 4): Resource leak (RESOURCE_LEAK)
20. leaked_storage: Variable "pm" going out of scope leaks the storage
it points to.

CID 996190 (#1 of 1): Resource leak (RESOURCE_LEAK)
13. leaked_storage: Variable "new" going out of scope leaks the storage
it points to.