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

Commitdce5073

Browse files
committed
Turn 'if' condition around to avoid Svace complaint
The unwritten assumption of this code is that both events->head andevents->tail are NULL together (an empty list) or they aren't. So thecode was testing events->head for nullness and using that as a cue todeference events->tail, which annoys the Svace static code analyzer.We can silence it by testing events->tail member instead, and add anassertion about events->head to ensure it's all consistent.This code is very old and as far as we know, there's never been a bugreport related to this, so there's no need to backpatch.This was found by the ALT Linux Team using Svace.Author: Alexander Kuznetsov <kuznetsovam@altlinux.org>Discussion:https://postgr.es/m/6d0323c3-3f5d-4137-af73-98a5ab90e77c@altlinux.org
1 parent1ab67c9 commitdce5073

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎src/backend/commands/trigger.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4097,8 +4097,11 @@ afterTriggerAddEvent(AfterTriggerEventList *events,
40974097
chunk->endptr=chunk->endfree= (char*)chunk+chunksize;
40984098
Assert(chunk->endfree-chunk->freeptr >=needed);
40994099

4100-
if (events->head==NULL)
4100+
if (events->tail==NULL)
4101+
{
4102+
Assert(events->head==NULL);
41014103
events->head=chunk;
4104+
}
41024105
else
41034106
events->tail->next=chunk;
41044107
events->tail=chunk;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp