You're trying to pfree(target) after having altered the target pointer inside the main loop of the function... regards, tom lane
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных