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

Commit31d8d47

Browse files
Guard against reallocation failure in pg_regress
realloc() will return NULL on a failed reallocation, so the destinationpointer must be inspected to avoid null pointer dereference. Further,assigning the return value to the source pointer leak the allocation inthe case of reallocation failure. Fix by using pg_realloc instead whichhas full error handling.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/9FC7E603-9246-4C62-B466-A39CFAF454AE@yesql.se
1 parent6c46e8a commit31d8d47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/test/regress/pg_regress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ fmtHba(const char *raw)
774774
constchar*rp;
775775
char*wp;
776776

777-
wp=ret=realloc(ret,3+strlen(raw)*2);
777+
wp=ret=pg_realloc(ret,3+strlen(raw)*2);
778778

779779
*wp++='"';
780780
for (rp=raw;*rp;rp++)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp