Fix for coverity bugs 349041, 349052 Allocated pointers could potentially be leaked in the case of errors. Signed-off-by: Paul Elliott <paul.elliott@arm.com>