Be more wary about partially-valid LOCALLOCK data in RemoveLocalLock().
Be more wary about partially-valid LOCALLOCK data in RemoveLocalLock().

RemoveLocalLock() must consider the possibility that LockAcquireExtended()
failed to palloc the initial space for a locallock's lockOwners array.
I had evidently meant to cope with this hazard when the code was originally
written (commit 1785acebf2ed14fd66955e2d9a55d77a025f418d), but missed that
the pfree needed to be protected with an if-test.  Just to make sure things
are left in a clean state, reset numLockOwners as well.

Per low-memory testing by Andreas Seltenreich.  Back-patch to all supported
branches.

jmcatamney/gpdb,adam8157/gpdb,jmcatamney/gpdb,50wu/gpdb,adam8157/gpdb,ashwinstar/gpdb,adam8157/gpdb,lisakowen/gpdb,adam8157/gpdb,50wu/gpdb,adam8157/gpdb,50wu/gpdb,adam8157/gpdb,jmcatamney/gpdb,lisakowen/gpdb,50wu/gpdb,jmcatamney/gpdb,50wu/gpdb,adam8157/gpdb,adam8157/gpdb,lisakowen/gpdb,xinzweb/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,lisakowen/gpdb,greenplum-db/gpdb,lisakowen/gpdb,xinzweb/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,lisakowen/gpdb,lisakowen/gpdb,ashwinstar/gpdb,50wu/gpdb,jmcatamney/gpdb,xinzweb/gpdb,50wu/gpdb,greenplum-db/gpdb,xinzweb/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,xinzweb/gpdb,lisakowen/gpdb,xinzweb/gpdb,ashwinstar/gpdb,50wu/gpdb,xinzweb/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,xinzweb/gpdb