Skip to content

Commit c923e82

Browse files
committed
Eliminate unnecessary NULL checks in picksplit method of intarray.
Where these checks were being done there was no code path which could leave them NULL. Michael Paquier per Coverity
1 parent cb66f49 commit c923e82

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

contrib/intarray/_int_gist.c

+5-11
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,7 @@ g_int_picksplit(PG_FUNCTION_ARGS)
416416
size_waste = size_union - size_inter;
417417

418418
pfree(union_d);
419-
420-
if (inter_d != (ArrayType *) NULL)
421-
pfree(inter_d);
419+
pfree(inter_d);
422420

423421
/*
424422
* are these a more promising split that what we've already seen?
@@ -517,21 +515,17 @@ g_int_picksplit(PG_FUNCTION_ARGS)
517515
/* pick which page to add it to */
518516
if (size_alpha - size_l < size_beta - size_r + WISH_F(v->spl_nleft, v->spl_nright, 0.01))
519517
{
520-
if (datum_l)
521-
pfree(datum_l);
522-
if (union_dr)
523-
pfree(union_dr);
518+
pfree(datum_l);
519+
pfree(union_dr);
524520
datum_l = union_dl;
525521
size_l = size_alpha;
526522
*left++ = i;
527523
v->spl_nleft++;
528524
}
529525
else
530526
{
531-
if (datum_r)
532-
pfree(datum_r);
533-
if (union_dl)
534-
pfree(union_dl);
527+
pfree(datum_r);
528+
pfree(union_dl);
535529
datum_r = union_dr;
536530
size_r = size_beta;
537531
*right++ = i;

0 commit comments

Comments
 (0)