genpipe.c: fixed memory buffer management bug