Remove unneeded null pointer checks before PQfreemem()
PQfreemem() just calls free(), and the latter already checks for null pointers. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com
This commit is contained in:
parent
45987aae26
commit
e890ce7a4f
@ -231,11 +231,8 @@ vacuumlo(const char *database, const struct _param *param)
|
||||
pg_log_error("%s", PQerrorMessage(conn));
|
||||
PQclear(res);
|
||||
PQfinish(conn);
|
||||
if (schema != NULL)
|
||||
PQfreemem(schema);
|
||||
if (table != NULL)
|
||||
PQfreemem(table);
|
||||
if (field != NULL)
|
||||
PQfreemem(field);
|
||||
return -1;
|
||||
}
|
||||
|
@ -741,7 +741,6 @@ static void
|
||||
libpqrcv_disconnect(WalReceiverConn *conn)
|
||||
{
|
||||
PQfinish(conn->streamConn);
|
||||
if (conn->recvBuf != NULL)
|
||||
PQfreemem(conn->recvBuf);
|
||||
pfree(conn);
|
||||
}
|
||||
@ -768,7 +767,6 @@ libpqrcv_receive(WalReceiverConn *conn, char **buffer,
|
||||
{
|
||||
int rawlen;
|
||||
|
||||
if (conn->recvBuf != NULL)
|
||||
PQfreemem(conn->recvBuf);
|
||||
conn->recvBuf = NULL;
|
||||
|
||||
|
@ -858,7 +858,6 @@ HandleCopyStream(PGconn *conn, StreamCtl *stream,
|
||||
}
|
||||
|
||||
error:
|
||||
if (copybuf != NULL)
|
||||
PQfreemem(copybuf);
|
||||
return NULL;
|
||||
}
|
||||
@ -940,7 +939,6 @@ CopyStreamReceive(PGconn *conn, long timeout, pgsocket stop_socket,
|
||||
char *copybuf = NULL;
|
||||
int rawlen;
|
||||
|
||||
if (*buffer != NULL)
|
||||
PQfreemem(*buffer);
|
||||
*buffer = NULL;
|
||||
|
||||
@ -1204,7 +1202,6 @@ HandleEndOfCopyStream(PGconn *conn, StreamCtl *stream, char *copybuf,
|
||||
}
|
||||
still_sending = false;
|
||||
}
|
||||
if (copybuf != NULL)
|
||||
PQfreemem(copybuf);
|
||||
*stoppos = blockpos;
|
||||
return res;
|
||||
|
Loading…
x
Reference in New Issue
Block a user