Skip to content

Commit d4c0b7a

Browse files
[yugabyte#27554] Ysql: Call YBCFreeStatus in yb_cancel_transaction to fix possible memory leak
Summary: Seen in PgCancelTxnTest_Simple.log but possibly contributing to other asan failures too. `yb_cancel_transaction` does not free the YbcStatus created in https://phorge.dev.yugabyte.com/diffusion/YBDB/browse/master/src/postgres/src/backend/utils/misc/pg_yb_utils.c$5318 YBCFreeStatus(status); should be called to reclaim memory. The issue is more visible after 0020131, but is not caused by this diff. More like a day-0 issue going back to D26550 / 29f8ac4 Jira: DB-17117 Test Plan: yb_build.sh asan --cxx-test pgwrapper_pg_txn_status-test --gtest_filter PgCancelTxnTest.Simple --clang19 Reviewers: jason, pjain, hsunder, telgersma Reviewed By: hsunder, telgersma Subscribers: telgersma, ybase, yql Differential Revision: https://phorge.dev.yugabyte.com/D44636
1 parent 006c7f3 commit d4c0b7a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/postgres/src/backend/utils/misc/pg_yb_utils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5328,8 +5328,10 @@ yb_cancel_transaction(PG_FUNCTION_ARGS)
53285328
ereport(NOTICE,
53295329
(errmsg("failed to cancel transaction"),
53305330
errdetail("%s", YBCMessageAsCString(status))));
5331+
YBCFreeStatus(status);
53315332
PG_RETURN_BOOL(false);
53325333
}
5334+
YBCFreeStatus(status);
53335335
PG_RETURN_BOOL(true);
53345336
}
53355337

0 commit comments

Comments
 (0)