Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcd92076

Browse files
authored
Merge pull request#8 from asp437/master
Fix potential memory corruption
2 parents1ab3270 +3abf353 commitcd92076

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

‎collector.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,13 @@ register_wait_collector(void)
3838
BackgroundWorkerworker;
3939

4040
/* Set up background worker parameters */
41+
memset(&worker,0,sizeof(worker));
4142
worker.bgw_flags=BGWORKER_SHMEM_ACCESS;
4243
worker.bgw_start_time=BgWorkerStart_ConsistentState;
4344
worker.bgw_restart_time=0;
4445
worker.bgw_notify_pid=0;
45-
#ifPG_VERSION_NUM >=100000|| defined(WIN32)
46-
memcpy(worker.bgw_library_name,"pg_wait_sampling",BGW_MAXLEN);
47-
memcpy(worker.bgw_function_name,CppAsString(collector_main),BGW_MAXLEN);
48-
#else
49-
worker.bgw_main=collector_main;
50-
#endif
46+
snprintf(worker.bgw_library_name,BGW_MAXLEN,"pg_wait_sampling");
47+
snprintf(worker.bgw_function_name,BGW_MAXLEN,CppAsString(collector_main));
5148
snprintf(worker.bgw_name,BGW_MAXLEN,"pg_wait_sampling collector");
5249
worker.bgw_main_arg= (Datum)0;
5350
RegisterBackgroundWorker(&worker);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp