Commit 2a01e05
authored
This commit fixes memory leaks observed when testing with ASan
1. In the function TdsSendRowDescription() , strdup() allocates memory using the system's malloc(), which is completely outside PostgreSQL's memory management. This means the string stored in relMetaDataInfo->partName[1] lives in malloc-heap, not in any PostgreSQL memory context.
By using pstrdup() , it allocates using palloc() inside the current memory context (MessageContext), so it's properly tracked and will be freed when that context is destroyed.
2. Similarly in the function rewrite_if_condition(), strdup uses malloc which is invisible to PostgreSQL's memory management while pstrdup allocates in the current memory context, which gets cleaned up automatically.
Task: BABEL-6422
Authored by : harshdu@amazon.com
1 parent b59c594 commit 2a01e05
File tree
2 files changed
+2
-2
lines changed- contrib
- babelfishpg_tds/src/backend/tds
- babelfishpg_tsql/src
2 files changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1638 | 1638 | | |
1639 | 1639 | | |
1640 | 1640 | | |
1641 | | - | |
| 1641 | + | |
1642 | 1642 | | |
1643 | 1643 | | |
1644 | 1644 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3009 | 3009 | | |
3010 | 3010 | | |
3011 | 3011 | | |
3012 | | - | |
| 3012 | + | |
3013 | 3013 | | |
3014 | 3014 | | |
3015 | 3015 | | |
| |||
0 commit comments