coverity
sysfs: fix use_after_free issue

CID 73379 (#1 of 1): Use after free (USE_AFTER_FREE)
31. deref_arg: Calling fclose dereferences freed pointer fp.
shmem: don't unmap a memrory region in restore_shmem_content()

This function doesn't allocate memory, so it should not release it.

CID 73380 (#1 of 1): Use after free (USE_AFTER_FREE)
14. deref_arg: Calling munmap dereferences freed pointer addr.
cgroups: fix use_after_free issue

list_for_each_entry_safe() should be used, you we are going to delete
something from a list.

CID 73383 (#1 of 1): Read from pointer after free (USE_AFTER_FREE)
4. deref_after_free: Dereferencing freed pointer prop.

Cc: Tycho Andersen <tycho.andersen@canonical.com>
restore: don't leak a transport socket

CID 73354 (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_handle: Handle variable sock going out of scope leaks the handle
dump: fix Out-of-bounds write

CID 73355 (#1 of 1): Out-of-bounds write (OVERRUN)
6. overrun-local: Overrunning array loc_buf of 4096 bytes at byte offset 4096 using index ret (which evaluates to 4096).
cgroup: don't give not null terminated string into strtoll()

CID 73345 (#1 of 1): String not null terminated (STRING_NULL)
2. string_null_argument: Function fread does not terminate string *buf. [Note: The source code implementation of the function has been overridden by a builtin model.]

Cc: Tycho Andersen <tycho.andersen@canonical.com>
sk-inet: don't leak sockets

CID 73347 (#7-4 of 7): Resource leak (RESOURCE_LEAK)
21. leaked_handle: Handle variable sk going out of scope leaks the handle.
ipc_ns: don't leak memory

CID 73377: Resource leak (RESOURCE_LEAK)
10. leaked_storage: Variable values going out of scope leaks the storage
it points to.
proc: don't leak memory

CID 73370: Resource leak (RESOURCE_LEAK)
13. leaked_storage: Variable timer going out of scope leaks the storage it points to.