Fix memory leak when deallocating prepared statement in postgres_fdw
authorMichael Paquier <[email protected]>
Tue, 26 Jan 2021 09:43:01 +0000 (18:43 +0900)
committerMichael Paquier <[email protected]>
Tue, 26 Jan 2021 09:43:01 +0000 (18:43 +0900)
The leak is minor, so no backpatch is done.  Oversight in 21734d2.

Reported-by: Tom Lane
contrib/postgres_fdw/postgres_fdw.c

index 8648be0b810f929cc922a063f0b501dc9cec8bc4..2ce42ce3f113dd493f6fc7803c6878fe71bf0d0d 100644 (file)
@@ -4063,6 +4063,7 @@ deallocate_query(PgFdwModifyState *fmstate)
    if (PQresultStatus(res) != PGRES_COMMAND_OK)
        pgfdw_report_error(ERROR, res, fmstate->conn, true, sql);
    PQclear(res);
+   pfree(fmstate->p_name);
    fmstate->p_name = NULL;
 }