[GRASS-dev] r.le--after some fixes still needs work

Glynn Clements glynn at gclements.plus.com
Thu Sep 28 13:13:39 EDT 2006


Hamish wrote:

> > I tried r.le in CVS HEAD after Hamish made some fixes. The fixes took
> > care of some problems.
> ..
> > But, r.le.pixel still crashes with memory bug
> 
> G63: spearfish> r.mapcalc elev=elevation.dem # it didn't like @othermapset
> G63: spearfish> r.le.pixel elev att=b1
> 
> PARAMETER CHOICES:
>         MAP:      elev
>         SAMPLE:   whole map    
>         ATTRIBUTE MEASURES:
>                   mean pixel attribute
> mkdir: cannot create directory `r.le.out': File exists
> 
> R.LE.PIXEL IS WORKING....;
> 
> Segmentation fault
> 
> 
> 
> this happens in G_free(), raster/r.le/r.le.pixel/cellclip.c line 417:
> 
>   switch (data_type) {
>      case CELL_TYPE:
>         G_free (tmp);
>         break;
> 
> 
> compile time warnings:
> 
> cellclip.c: In function `cell_clip_drv':
> cellclip.c:82: warning: passing arg 2 of `cell_clip' from incompatible pointer type
> cellclip.c:129: warning: passing arg 2 of `center_is_not_null' from incompatible pointer type

null_buf is being allocated with one char per column, but everything
else assumes that it holds one DCELL per column (although, AFAICT,
they only check for zero/non-zero).

The "right" solution is to change everything to treat it as char**;
the easy solution is to allocate one DCELL per column.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list