Add terminating condition in mpool_free()