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

Commit4eca51d

Browse files
committed
Don't leak malloc'd error string in libpqrcv_check_conninfo().
We leaked the error report from PQconninfoParse, when there wasone. It seems unlikely that real usage patterns would repeatthe failure often enough to create serious bloat, but let'sback-patch anyway to keep the code similar in all branches.Found via valgrind testing.Back-patch to v10 where this code was added.Discussion:https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us
1 parentfc552f8 commit4eca51d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,15 @@ libpqrcv_check_conninfo(const char *conninfo)
244244

245245
opts=PQconninfoParse(conninfo,&err);
246246
if (opts==NULL)
247+
{
248+
/* The error string is malloc'd, so we must free it explicitly */
249+
char*errcopy=err ?pstrdup(err) :"out of memory";
250+
251+
PQfreemem(err);
247252
ereport(ERROR,
248253
(errcode(ERRCODE_SYNTAX_ERROR),
249-
errmsg("invalid connection string syntax: %s",err)));
254+
errmsg("invalid connection string syntax: %s",errcopy)));
255+
}
250256

251257
PQconninfoFree(opts);
252258
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp