Fixed memory leaks and malloc(0)
Fixed memory leaks and malloc(0)

Fixed some minor leaks in error branches.
Prevent a malloc(0) from occurring by bailing beforehand.

Change-Id: I85cdc7d12a2598d477f3b956b86d445273698ed6

sankhesh/VTK,johnkit/vtk-dev,sankhesh/VTK,demarle/VTK,jmerkow/VTK,mspark93/VTK,demarle/VTK,hendradarwin/VTK,gram526/VTK,ashray/VTK-EVM,keithroe/vtkoptix,candy7393/VTK,ashray/VTK-EVM,hendradarwin/VTK,demarle/VTK,gram526/VTK,demarle/VTK,johnkit/vtk-dev,SimVascular/VTK,candy7393/VTK,SimVascular/VTK,sankhesh/VTK,johnkit/vtk-dev,sumedhasingla/VTK,keithroe/vtkoptix,johnkit/vtk-dev,keithroe/vtkoptix,candy7393/VTK,jmerkow/VTK,keithroe/vtkoptix,gram526/VTK,mspark93/VTK,jmerkow/VTK,demarle/VTK,candy7393/VTK,SimVascular/VTK,sumedhasingla/VTK,gram526/VTK,msmolens/VTK,msmolens/VTK,sankhesh/VTK,msmolens/VTK,msmolens/VTK,ashray/VTK-EVM,jmerkow/VTK,hendradarwin/VTK,mspark93/VTK,msmolens/VTK,sumedhasingla/VTK,candy7393/VTK,sankhesh/VTK,mspark93/VTK,candy7393/VTK,msmolens/VTK,keithroe/vtkoptix,gram526/VTK,sumedhasingla/VTK,ashray/VTK-EVM,SimVascular/VTK,hendradarwin/VTK,keithroe/vtkoptix,hendradarwin/VTK,sankhesh/VTK,sankhesh/VTK,mspark93/VTK,candy7393/VTK,SimVascular/VTK,demarle/VTK,ashray/VTK-EVM,SimVascular/VTK,demarle/VTK,jmerkow/VTK,jmerkow/VTK,ashray/VTK-EVM,keithroe/vtkoptix,sumedhasingla/VTK,sumedhasingla/VTK,keithroe/vtkoptix,demarle/VTK,ashray/VTK-EVM,gram526/VTK,gram526/VTK,johnkit/vtk-dev,hendradarwin/VTK,hendradarwin/VTK,mspark93/VTK,johnkit/vtk-dev,ashray/VTK-EVM,sumedhasingla/VTK,mspark93/VTK,sankhesh/VTK,sumedhasingla/VTK,jmerkow/VTK,SimVascular/VTK,msmolens/VTK,mspark93/VTK,jmerkow/VTK,SimVascular/VTK,candy7393/VTK,gram526/VTK,johnkit/vtk-dev,msmolens/VTK