ZigzagAK commented on code in PR #2258:
URL: https://github.com/apache/age/pull/2258#discussion_r2587992606
##########
src/backend/utils/adt/agtype.c:
##########
@@ -5708,8 +5716,6 @@ Datum age_startnode(PG_FUNCTION_ARGS)
result = get_vertex(graph_name, label_name, start_id);
- free(label_name);
Review Comment:
Because `result = strdup(result);` was replaced with `result =
pstrdup(result);` in `get_label_name` by this PR.
We can't use standard malloc/realloc/free/strdup/... functions safely
because in every moment when we use postgresql functions our codeflow may be
breaked by longjmp via ereport(ERROR). We must use memory context functions to
allocate memory in the request. All allocated memory will be freed at the end
of current request.
We can use `pfree`, but it is not required for short-lived requests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]