Skip to content

Commit

Permalink
Fix bad use of repalloc
Browse files Browse the repository at this point in the history
In contrast to `realloc`, `repalloc` does not accept a null pointer.
This means that it is necessary to select either `repalloc` or `palloc`
depending on whether the realloc pointer is null or not.
  • Loading branch information
mkindahl committed Jun 30, 2021
1 parent 3627189 commit 8bfe994
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/plan_expand_hypertable.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ is_time_bucket_function(Expr *node)
static void
ts_setup_append_rel_array(PlannerInfo *root)
{
root->append_rel_array =
repalloc(root->append_rel_array, root->simple_rel_array_size * sizeof(AppendRelInfo *));
if (root->append_rel_array)
root->append_rel_array =
repalloc(root->append_rel_array, root->simple_rel_array_size * sizeof(AppendRelInfo *));
else
root->append_rel_array = palloc(root->simple_rel_array_size * sizeof(AppendRelInfo *));

ListCell *lc;
foreach (lc, root->append_rel_list)
{
Expand Down

0 comments on commit 8bfe994

Please sign in to comment.