[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 20020313: ncendef error
- Subject: Re: 20020313: ncendef error
- Date: Thu, 19 Sep 2002 17:16:32 -0600
Hi Masaki Fukuda and V. Lakshmanan,
"V. Lakshmanan" <address@hidden> wrote:
> I finally found the problem, thanks to valgrind.
> There is an uninitalized local variable at:
>
> putget.c:1896
> void* xp;
> which should be:
> void *xp = NULL;
> since that variable gets used in:
> int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
> RGN_WRITE, &xp);
> and libsrc/posixio.c:486 uses it:
> if (*vpp == NULL)
>
> which is why my program would crash every
> once in a long while.
and Masaki Fukuda <address@hidden> wrote:
> I think the pointer expected to initialize NULL(see the patch which
> attached in this mail).
>
> Am I correct?, Is this a bug?
> If correct, I'm appliciated that the bug fixed in the next version.
Thanks, you have both identified the same bug. I used Purify to
verify that the appended patch in the libsrc/ directory gets rid of
all Uninitialized Memory Reads (UMRs) when running nc_test. This fix
will be included in the next release, and you have both been added to
and acknowledged in the list of Credits for netCDF contributions at:
http://www.unidata.ucar.edu/packages/netcdf/credits.html
--Russ
cvs diff: Diffing .
Index: nc.c
===================================================================
RCS file: /upc/share/CVS/netcdf-3/libsrc/nc.c,v
retrieving revision 2.119
diff -r2.119 nc.c
308c308
< const void *xp;
---
> const void *xp = NULL;
343c343
< void *xp;
---
> void *xp = NULL;
Index: putget.m4
===================================================================
RCS file: /upc/share/CVS/netcdf-3/libsrc/putget.m4,v
retrieving revision 2.47
diff -r2.47 putget.m4
130c130
< void *xp;
---
> void *xp = NULL;
321c321
< void *xp;
---
> void *xp = NULL;
587c587
< void *xp;
---
> void *xp = NULL;
731c731
< const void *xp;
---
> const void *xp = NULL;