Ticket #4709 (closed defect: fixed)

Opened 12 months ago

Last modified 12 months ago

NCDFAddGDALHistory() uses free'd memory

Reported by: rouault Owned by: 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

Changed 12 months ago by rouault

  • status changed from new to closed
  • resolution set to fixed

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)

Changed 12 months ago by etourigny

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

Note: See TracTickets for help on using tickets.