Rodrigo Hjort <rodrigo(dot)hjort(at)gmail(dot)com> writes:
> I'm having some problems when using "pfree()" on functions in C.
I think your pfree is just the bearer of bad news, ie, it's the victim
of a memory clobber that you've already executed. Take another look at
your string manipulation --- that strncpy followed by strcat in
particular looks pretty dangerous, because strncpy doesn't guarantee
a trailing null.
[ looks again... ] Hmm, not to mention that you are overwriting the
input "str", which is bad enough in itself, but you are doing so with
a string longer than the original.
regards, tom lane