[GRASS-dev] [bug #4987] (grass) malloc errors/declaration - 64 bit problems

Request Tracker grass-bugs at intevation.de
Tue Aug 8 10:16:28 EDT 2006


this bug's URL: http://intevation.de/rt/webrt?serial_num=4987
-------------------------------------------------------------------------

Subject: malloc errors/declaration - 64 bit problems

grass obtained from: CVS
grass binary for platform: Compiled from Sources

Copied to bugtracker by MN.
-------

On Tue, Aug 08, 2006 at 04:10:04PM +0200, Roberto Flor wrote:
Here my findings on 64 bit problems:

Simple, potential error on 64 bit machines, really only for float case:

./raster/simwe/r.sim.sediment/main.c:   si = (double **)G_malloc (sizeof(double)*(my));
./raster/simwe/r.sim.sediment/main.c:   sigma = (double **)G_malloc (sizeof(double)*(my));
./raster/simwe/r.sim.sediment/main.c:        dif = (float **)G_malloc (sizeof(float)*(my));
./raster/simwe/r.sim.sediment/main.c:        er = (float **)G_malloc (sizeof(float)*(my));
./vector/v.surf.idw/main.c:    npoints_currcell = (long **)G_malloc(window.rows * sizeof(long));


Overzealous but should'nt be a problem:

./raster/r.param.scale/nrutil.c:        t = (float ***) G_malloc (((nrow+NR_END) * sizeof(float**)));
./imagery/i.smap/bouman/multialloc.c:          r[0]=(char *)G_malloc(max*sizeof(char **));
./lib/imagery/alloc.c:    x = (double ***)G_malloc((a+1) * sizeof(double **));


Hyper allocation, requires more memory than necessary:

./vector/v.surf.idw/main.c:        search_list = (struct cell_list **)G_malloc(max_radius * sizeof(struct cell_list));
./vector/v.surf.idw/main.c:        search_list_start = (struct cell_list **)G_malloc(max_radius * sizeof(struct cell_list));
./vector/v.surf.idw/main.c:    points = (struct Point ***)G_malloc(window.rows * sizeof(struct Point));
./vector/v.surf.idw/main.c:        points[row] = (struct Point **)G_malloc(window.cols * sizeof(struct Point));

In all the case the sizeof shoul to be of a pointer.

-------------------------------------------- Managed by Request Tracker




More information about the grass-dev mailing list