mirror of
https://github.com/postgres/postgres.git
synced 2025-07-20 05:03:10 +03:00
Add destroyStringInfo function for cleaning up StringInfos
destroyStringInfo() is a counterpart to makeStringInfo(), freeing a palloc'd StringInfo and its data. This is a convenience function to align the StringInfo API with the PQExpBuffer API. Originally added in the OAuth patchset, it was extracted and committed separately in order to aid upcoming JSON work. Author: Daniel Gustafsson <daniel@yesql.se> Author: Jacob Champion <jacob.champion@enterprisedb.com> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/CAOYmi+mWdTd6ujtyF7MsvXvk7ToLRVG_tYAcaGbQLvf=N4KrQw@mail.gmail.com
This commit is contained in:
@ -2163,8 +2163,7 @@ xml_errorHandler(void *data, PgXmlErrorPtr error)
|
||||
appendBinaryStringInfo(&xmlerrcxt->err_buf, errorBuf->data,
|
||||
errorBuf->len);
|
||||
|
||||
pfree(errorBuf->data);
|
||||
pfree(errorBuf);
|
||||
destroyStringInfo(errorBuf);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2195,8 +2194,7 @@ xml_errorHandler(void *data, PgXmlErrorPtr error)
|
||||
(errmsg_internal("%s", errorBuf->data)));
|
||||
}
|
||||
|
||||
pfree(errorBuf->data);
|
||||
pfree(errorBuf);
|
||||
destroyStringInfo(errorBuf);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user