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

Commit9bacdf9

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 parent377b7a8 commit9bacdf9

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
@@ -246,9 +246,15 @@ libpqrcv_check_conninfo(const char *conninfo)
246246

247247
opts=PQconninfoParse(conninfo,&err);
248248
if (opts==NULL)
249+
{
250+
/* The error string is malloc'd, so we must free it explicitly */
251+
char*errcopy=err ?pstrdup(err) :"out of memory";
252+
253+
PQfreemem(err);
249254
ereport(ERROR,
250255
(errcode(ERRCODE_SYNTAX_ERROR),
251-
errmsg("invalid connection string syntax: %s",err)));
256+
errmsg("invalid connection string syntax: %s",errcopy)));
257+
}
252258

253259
PQconninfoFree(opts);
254260
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp