Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV' into nirmit-dt-…
Browse files Browse the repository at this point in the history
…upgrade
  • Loading branch information
Nirmit Shah committed Dec 31, 2024
2 parents 8ee86a6 + fd5eca1 commit 92e1a50
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions contrib/babelfishpg_tds/src/backend/tds/tds.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ typedef struct LocalTdsStatus
} LocalTdsStatus;

static TdsStatus *TdsStatusArray = NULL;
static TdsStatus *MyTdsStatusEntry;
static TdsStatus *MyTdsStatusEntry = NULL;
static LocalTdsStatus *localTdsStatusTable = NULL;

uint32_t MyTdsClientVersion = 0;
Expand Down Expand Up @@ -446,9 +446,17 @@ tds_stats_shmem_shutdown(int code, Datum arg)
return;

/* Safety check ... shouldn't get here unless shmem is set up. */
if (TdsStatusArray == NULL)
if (TdsStatusArray == NULL || MyTdsStatusEntry == NULL)
return;

PGSTAT_BEGIN_WRITE_ACTIVITY(MyTdsStatusEntry);

MyTdsStatusEntry->st_procpid = 0; /* mark invalid */

PGSTAT_END_WRITE_ACTIVITY(MyTdsStatusEntry);

MyTdsStatusEntry = NULL;

return;
}

Expand Down

0 comments on commit 92e1a50

Please sign in to comment.