mirror of
https://github.com/postgres/postgres.git
synced 2025-05-21 15:54:08 +03:00
Fix memory leak in connection string validation.
Introduced in commit c3afe8cf5a. Discussion: https://postgr.es/m/066a65233d3cb4ea27a9e0778d2f1d0dc764b222.camel@j-davis.com Reviewed-by: Nathan Bossart, Tom Lane Backpatch-through: 16
This commit is contained in:
parent
4c03ac7e2b
commit
41820e640a
@ -284,10 +284,15 @@ libpqrcv_check_conninfo(const char *conninfo, bool must_use_password)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!uses_password)
|
if (!uses_password)
|
||||||
|
{
|
||||||
|
/* malloc'd, so we must free it explicitly */
|
||||||
|
PQconninfoFree(opts);
|
||||||
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED),
|
(errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED),
|
||||||
errmsg("password is required"),
|
errmsg("password is required"),
|
||||||
errdetail("Non-superusers must provide a password in the connection string.")));
|
errdetail("Non-superusers must provide a password in the connection string.")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PQconninfoFree(opts);
|
PQconninfoFree(opts);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user