Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions contrib/pg_stat_statements/pg_stat_statements.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,10 @@ pgss_shmem_shutdown(int code, Datum arg)
errmsg("could not write file \"%s\": %m",
PGSS_DUMP_FILE ".tmp")));
if (qbuffer)
{
free(qbuffer);
qbuffer = NULL;
}
if (file)
FreeFile(file);
unlink(PGSS_DUMP_FILE ".tmp");
Expand Down Expand Up @@ -2310,7 +2313,7 @@ need_gc_qtexts(void)
static void
gc_qtexts(void)
{
char *qbuffer;
char *qbuffer = NULL;
Size qbuffer_size;
FILE *qfile = NULL;
HASH_SEQ_STATUS hash_seq;
Expand Down Expand Up @@ -2425,6 +2428,7 @@ gc_qtexts(void)
pgss->mean_query_len = ASSUMED_LENGTH_INIT;

free(qbuffer);
qbuffer = NULL;

/*
* OK, count a garbage collection cycle. (Note: even though we have
Expand Down Expand Up @@ -2681,8 +2685,10 @@ generate_normalized_query(JumbleState *jstate, const char *query,
n_quer_loc += len_to_wrt;

/* And insert a param symbol in place of the constant token */
n_quer_loc += sprintf(norm_query + n_quer_loc, "$%d",
i + 1 + jstate->highest_extern_param_id);
n_quer_loc += snprintf(norm_query + n_quer_loc,
norm_query_buflen - n_quer_loc + 1,
"$%d",
i + 1 + jstate->highest_extern_param_id);

quer_loc = off + tok_len;
last_off = off;
Expand Down
Loading