mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Use safer allocation routines in more places of the tree
This is part of a more global effort to modernize the code tree with
safer allocation functions, which offer more protection in terms of:
- stronger type safety guarantees
- size overflow checks, particulary for arrays.
This set of updates includes allocation changes based on
palloc_object(), palloc_array() and repalloc_array(). This work is
similar to 1b105f9472, expanding more the new APIs in the tree in an
incremental fashion.
Author: Tristan Partin <tristan@partin.io>
Discussion: https://postgr.es/m/DKJB5887LGX9.359DV1UMZ1URK@partin.io
This commit is contained in:
@@ -485,7 +485,7 @@ ExecInitGenerated(ResultRelInfo *resultRelInfo,
|
||||
*/
|
||||
oldContext = MemoryContextSwitchTo(estate->es_query_cxt);
|
||||
|
||||
ri_GeneratedExprs = (ExprState **) palloc0(natts * sizeof(ExprState *));
|
||||
ri_GeneratedExprs = palloc0_array(ExprState *, natts);
|
||||
ri_NumGeneratedNeeded = 0;
|
||||
|
||||
for (int i = 0; i < natts; i++)
|
||||
|
||||
Reference in New Issue
Block a user