SPI_cursor_close(portal);
SPI_finish();
- if (NULL != covhist) pfree(covhist);
+ if (NULL != covhist) free(covhist);
if (bin_width_count) pfree(bin_width);
SRF_RETURN_DONE(funcctx);
SPI_cursor_close(portal);
SPI_finish();
- if (NULL != covhist) pfree(covhist);
+ if (NULL != covhist) free(covhist);
if (bin_width_count) pfree(bin_width);
SRF_RETURN_DONE(funcctx);
SPI_finish();
rt_raster_destroy(raster);
- if (NULL != covhist) pfree(covhist);
+ if (NULL != covhist) free(covhist);
if (bin_width_count) pfree(bin_width);
SRF_RETURN_DONE(funcctx);
SPI_finish();
rt_raster_destroy(raster);
- if (NULL != covhist) pfree(covhist);
+ if (NULL != covhist) free(covhist);
if (bin_width_count) pfree(bin_width);
SRF_RETURN_DONE(funcctx);
SPI_cursor_close(portal);
SPI_finish();
- if (NULL != covhist) pfree(covhist);
+ if (NULL != covhist) free(covhist);
if (bin_width_count) pfree(bin_width);
SRF_RETURN_DONE(funcctx);
SPI_cursor_close(portal);
SPI_finish();
- if (NULL != covhist) pfree(covhist);
+ if (NULL != covhist) free(covhist);
if (bin_width_count) pfree(bin_width);
SRF_RETURN_DONE(funcctx);
/* coverage histogram */
if (NULL == covhist) {
- covhist = (rt_histogram) palloc(sizeof(struct rt_histogram_t) * count);
+ /*
+ dustymugs 2011-08-25
+ covhist is initialized using malloc instead of palloc due to
+ strange memory issues where covvcnts is corrupted in
+ subsequent calls of SRF
+ */
+ covhist = (rt_histogram) malloc(sizeof(struct rt_histogram_t) * count);
if (NULL == covhist) {
elog(ERROR, "RASTER_histogramCoverage: Unable to allocate memory for histogram of coverage");
}
/* do when there is no more left */
else {
- pfree(covhist2);
+ free(covhist2);
SRF_RETURN_DONE(funcctx);
}
}
SRF_RETURN_DONE(funcctx);
}
cov_count = strtol(tmp, NULL, 10);
- POSTGIS_RT_DEBUGF(3, "covcount = %d", cov_count);
+ POSTGIS_RT_DEBUGF(3, "covcount = %d", (int) cov_count);
pfree(tmp);
/* iterate through rasters of coverage */
/*
dustymugs 2011-08-23
- The following block seems to remove a strange memory
- issue only in OSX (tested on 64-bit only) where
- covquant is corrupted in subsequent calls of SRF
+ covquant2 is initialized using malloc instead of palloc due to
+ strange memory issues where covvcnts is corrupted in
+ subsequent calls of SRF
*/
- covquant2 = palloc(sizeof(struct rt_quantile_t) * count);
+ covquant2 = malloc(sizeof(struct rt_quantile_t) * count);
for (i = 0; i < count; i++) {
covquant2[i].quantile = covquant[i].quantile;
covquant2[i].value = covquant[i].value;
}
pfree(covquant);
- covquant = covquant2;
POSTGIS_RT_DEBUGF(3, "%d quantiles returned", count);
/* Store needed information */
- funcctx->user_fctx = covquant;
+ funcctx->user_fctx = covquant2;
/* total number of tuples to be returned */
funcctx->max_calls = count;
/* do when there is no more left */
else {
POSTGIS_RT_DEBUG(3, "done");
- pfree(covquant2);
+ free(covquant2);
SRF_RETURN_DONE(funcctx);
}
}
if (NULL == covvcnts) {
/*
dustymugs 2011-08-23
- covvcnts is initialized using malloc instead of palloc due to the strange
- memory issue only seen in OSX (tested on 64-bit only) where
- covvcnts is corrupted in subsequent calls of SRF
+ covvcnts is initialized using malloc instead of palloc due to
+ strange memory issues where covvcnts is corrupted in
+ subsequent calls of SRF
*/
covvcnts = (rt_valuecount) malloc(sizeof(struct rt_valuecount_t) * count);
if (NULL == covvcnts) {