diff --git a/src/pg_tracing.h b/src/pg_tracing.h index a204f58..df4257c 100644 --- a/src/pg_tracing.h +++ b/src/pg_tracing.h @@ -270,7 +270,7 @@ extern void parse_trace_context(pgTracingTraceparent * traceparent, const char * extern const char *normalise_query(const char *query, int query_loc, int *query_len_p); extern bool text_store_file(pgTracingSharedState * pg_tracing, const char *query, int query_len, Size *query_offset); -extern const char *qtext_load_file(Size *buffer_size); +extern char *qtext_load_file(Size *buffer_size); /* pg_tracing_span.c */ extern void begin_span(TraceId trace_id, Span * span, SpanType type, diff --git a/src/pg_tracing_query_process.c b/src/pg_tracing_query_process.c index 938e5b9..b5193bb 100644 --- a/src/pg_tracing_query_process.c +++ b/src/pg_tracing_query_process.c @@ -439,7 +439,7 @@ text_store_file(pgTracingSharedState * pg_tracing, const char *text, int text_le * * On success, the buffer size is also returned into *buffer_size. */ -const char * +char * qtext_load_file(Size *buffer_size) { char *buf; diff --git a/src/pg_tracing_sql_functions.c b/src/pg_tracing_sql_functions.c index e86f9b9..f88b4f9 100644 --- a/src/pg_tracing_sql_functions.c +++ b/src/pg_tracing_sql_functions.c @@ -213,7 +213,7 @@ pg_tracing_spans(PG_FUNCTION_ARGS) bool consume; ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; Span *span; - const char *qbuffer; + char *qbuffer; Size qbuffer_size = 0; LWLockMode lock_mode = LW_SHARED; @@ -263,6 +263,7 @@ pg_tracing_spans(PG_FUNCTION_ARGS) pg_tracing_shared_state->stats.last_consume = GetCurrentTimestamp(); LWLockRelease(pg_tracing_shared_state->lock); + free(qbuffer); return (Datum) 0; }