libibumad: fix freeing wrong memory on failure