Move newfilter malloc to avoid possible memory leak.

Detected by clang's static analyzer.