Don't repeat the same requests for pipelined dynamic requests

- Call script_request() as many times as the length of the pipeline to
  prepare a pipelined request
- Use zmalloc/zfree for preparing a pipelined request
- Fix memory leak related with pipelining