mirror of
https://github.com/postgres/postgres.git
synced 2026-03-12 05:32:27 -04:00
Check for NULL result from strdup
Per Coverity Scan
This commit is contained in:
parent
5fbc3130b3
commit
980c24e1e8
1 changed files with 11 additions and 1 deletions
|
|
@ -1132,7 +1132,17 @@ initialize_SSL(PGconn *conn)
|
|||
{
|
||||
/* Colon, but not in second character, treat as engine:key */
|
||||
char *engine_str = strdup(conn->sslkey);
|
||||
char *engine_colon = strchr(engine_str, ':');
|
||||
char *engine_colon;
|
||||
|
||||
if (engine_str == NULL)
|
||||
{
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("out of memory\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* cannot return NULL because we already checked before strdup */
|
||||
engine_colon = strchr(engine_str, ':');
|
||||
|
||||
*engine_colon = '\0'; /* engine_str now has engine name */
|
||||
engine_colon++; /* engine_colon now has key name */
|
||||
|
|
|
|||
Loading…
Reference in a new issue