Skip to content

Commit

Permalink
libraster (#463)
Browse files Browse the repository at this point in the history
Rast_get_vrt_row(): avoid free'ing of current vrt struct with Rast__check_for_auto_masking()
  • Loading branch information
metzm committed Mar 28, 2020
1 parent 2f4d3ab commit 7802cad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/raster/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ static int init(void)

R__.nbytes = sizeof(CELL);

R__.fileinfo_count = 0;
R__.fileinfo = NULL;

R__.compression_type = G_default_compressor();

cname = getenv("GRASS_COMPRESSOR");
Expand Down
1 change: 1 addition & 0 deletions lib/raster/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ static int open_raster_new(const char *name, int open_mode,
fcb->map_type = map_type;
fcb->open_mode = -1;
fcb->gdal = NULL;
fcb->vrt = NULL;

/* for writing fcb->data is allocated to be R__.wr_window.cols *
sizeof(CELL or DCELL or FCELL) */
Expand Down
3 changes: 2 additions & 1 deletion lib/raster/vrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ int Rast_get_vrt_row(int fd, void *buf, int row, RASTER_MAP_TYPE data_type)
* a mask is applied to the collected data
* after this function returns */
Rast_set_null_value(tmpbuf, rd_window->cols, data_type);
tfd = Rast_open_old(p->name, p->mapset);
/* avoid Rast__check_for_auto_masking() */
tfd = Rast__open_old(p->name, p->mapset);
Rast_get_row_nomask(tfd, tmpbuf, row, data_type);
Rast_unopen(tfd);

Expand Down

0 comments on commit 7802cad

Please sign in to comment.