Skip to content

Commit

Permalink
Add missing free on qbuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
bonnefoa committed Jun 21, 2024
1 parent b31aa2a commit eca9c9c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pg_tracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/pg_tracing_query_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/pg_tracing_sql_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit eca9c9c

Please sign in to comment.