partition2enumeration: fix memory leak when input is zero