Removed unnecessary assignment.

Clang static analyzer pointed out that the value assigned to 'pos'
is never read.
Avoid potential memory leak.

Previously, if malloc failed to allocate 'newstack', the function
would return without freeing 'stack'.  Pointed out by clang static
analyzer.