MuhammadTahaNaveed commented on code in PR #2303:
URL: https://github.com/apache/age/pull/2303#discussion_r2678781519


##########
src/backend/utils/adt/agtype.c:
##########
@@ -2308,7 +2356,25 @@ Datum _agtype_build_vertex(PG_FUNCTION_ARGS)
     }
 
     id = AG_GETARG_GRAPHID(0);
-    label = PG_GETARG_CSTRING(1);
+    label_agtype = AG_GET_ARG_AGTYPE_P(1);
+
+    /* Extract the string from the agtype label */
+    if (!AGT_ROOT_IS_SCALAR(label_agtype))
+    {
+        ereport(ERROR,
+                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+                 errmsg("_agtype_build_vertex() label must be a scalar 
string")));
+    }
+
+    label_value = get_ith_agtype_value_from_container(&label_agtype->root, 0);
+    if (label_value->type != AGTV_STRING)
+    {
+        ereport(ERROR,
+                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+                 errmsg("_agtype_build_vertex() label must be a string")));
+    }
+
+    label = pnstrdup(label_value->val.string.val, label_value->val.string.len);

Review Comment:
   it is freed at the end of function



-- 
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]

Reply via email to