Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#4709 closed defect (fixed)

NCDFAddGDALHistory() uses free'd memory

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 1.9.2
Component: GDAL_Raster Version: 1.9.0
Severity: normal Keywords: netcdf
Cc: etourigny

Description

Detected by valgrind :

nc_put_att_text( fpImage, NC_GLOBAL, "GDAL", strlen(NCDF_GDAL), NCDF_GDAL ); uses free'd memory since successive calls to GDALVersionInfo() will free the buffer returned by the previous call.

Solution : store NCDF_GDAL in a local variable to avoid calling GDALVersionInfo() twice.

Change History (2)

comment:1 Changed 9 years ago by Even Rouault

Resolution: fixed
Status: newclosed

r24588 /trunk/gdal/frmts/netcdf/ (netcdfdataset.cpp netcdfdataset.h): netCDF: fix use of free'd memory in NCDFAddGDALHistory() (#4709)

r24589 /branches/1.9/gdal/frmts/netcdf/ (netcdfdataset.cpp netcdfdataset.h): netCDF: fix use of free'd memory in NCDFAddGDALHistory() (#4709)

comment:2 Changed 9 years ago by etourigny

didn't ever see that one - perhaps depends on the compiler? Thanks

Note: See TracTickets for help on using tickets.