obj: fix logging alloc

The alloc operation should be logged before allocating memory.