Fixed a backwards ‘if’ test, and memory leak

The test was very likely backwards, and anyway unneeded,
as it’s safe to pass null to delete.

Change-Id: I8d54af9a3fe5d168e5ef17e799ffc2c42508d517
Eliminated unneeded null checks before using delete/free

Change-Id: I76fea205f42b796bcfc5d47b6f171d39eadd44a4
Merge topic 'unneeded-delete-checks' into master

de54031e Eliminated unneeded null checks before using delete/free
fe69c242 Fixed a backwards ‘if’ test, and memory leak