net/mlx4: separate memory management functions