Fix: use after free in agent subsystem

Fixes Coverity issue 1230592.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: possible file descriptor leak in error path

Fixes Coverity issue 1225086.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: kernel context memory leak on error

Fixes Coverity issue 1223776.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: memory leak in load session thread

Fixes Coverity issue 1213789.

Signed-off-by: David Goulet <dgoulet@efficios.com>