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

Commit5201bba

Browse files
author
Etsuro Fujita
committed
Fix memory allocation/copy mistakes.
The previous code was allocating more memory and copying more data thannecessary because it specified the wrong PgStat_KindInfo member as thesize argument for MemoryContextAlloc and memcpy, respectively.Although these issues exist since5891c7a, there have been no reportsfrom the field. So for now, it seems sufficient to fix them in master.Author: Etsuro Fujita <etsuro.fujita@gmail.com>Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>Reviewed-by: Gurjeet Singh <gurjeet@singh.im>Discussion:https://postgr.es/m/CAPmGK15eTRCZTnfgQ4EuBNo%3DQLYGFEbXS_7m2dXqtkcT7L8qrQ%40mail.gmail.com
1 parent6e91b9c commit5201bba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/backend/utils/activity/pgstat.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ pgstat_build_snapshot(void)
11871187
Assert(!found);
11881188

11891189
entry->data=MemoryContextAlloc(pgStatLocal.snapshot.context,
1190-
kind_info->shared_size);
1190+
pgstat_get_entry_len(kind));
11911191

11921192
/*
11931193
* Acquire the LWLock directly instead of using
@@ -1196,7 +1196,7 @@ pgstat_build_snapshot(void)
11961196
LWLockAcquire(&stats_data->lock,LW_SHARED);
11971197
memcpy(entry->data,
11981198
pgstat_get_entry_data(kind,stats_data),
1199-
kind_info->shared_size);
1199+
pgstat_get_entry_len(kind));
12001200
LWLockRelease(&stats_data->lock);
12011201
}
12021202
dshash_seq_term(&hstat);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp