mit-kdb: Fix NULL pointer check after malloc