Skip to content

Commit

Permalink
Copy route count before freeing memory (MobilityDB#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
mschoema authored Apr 17, 2024
1 parent dacd091 commit 6e0e657
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mobilitydb/src/npoint/tnpoint_gin.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ Tnpoint_gin_extract_value(PG_FUNCTION_ARGS)
Datum *elems = palloc(sizeof(Datum) * routes->count);
for (int i = 0; i < routes->count; i++)
elems[i] = Int64GetDatum(SET_VAL_N(routes, i));
pfree(routes);
*nkeys = routes->count;
*nullFlags = NULL;
pfree(routes);
PG_FREE_IF_COPY(temp, 0);
PG_RETURN_POINTER(elems);
}
Expand Down Expand Up @@ -127,9 +127,9 @@ Tnpoint_gin_extract_query(PG_FUNCTION_ARGS)
elems = palloc(sizeof(Datum) * routes->count);
for (int i = 0; i < routes->count; i++)
elems[i] = Int64GetDatum(SET_VAL_N(routes, i));
pfree(routes);
*nkeys = routes->count;
*searchMode = GIN_SEARCH_MODE_DEFAULT;
pfree(routes);
PG_FREE_IF_COPY(temp, 0);
break;
default:
Expand Down

0 comments on commit 6e0e657

Please sign in to comment.