# Grdimage aborted due to: double free or corruption (out)

**URL:** <https://forum.generic-mapping-tools.org/t/grdimage-aborted-due-to-double-free-or-corruption-out/3095>\
**Category:** Q&A\
**Created:** [July 7, 2022, 10:39am UTC](https://forum.generic-mapping-tools.org/t/grdimage-aborted-due-to-double-free-or-corruption-out/3095 "2022-07-07T10:39:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![eejap](https://avatars.discourse-cdn.com/v4/letter/e/f04885/32.png) [@eejap](https://forum.generic-mapping-tools.org/u/eejap)\
**Post date:** [July 7, 2022, 10:39am UTC](https://forum.generic-mapping-tools.org/t/grdimage-aborted-due-to-double-free-or-corruption-out/3095/1 "2022-07-07T10:39:17Z")

</div>

Hello,

I am trying to plot a geotiff using grdimage that I produced in matlab. The command I am running is:

gmt grdimage geotiff.geo.tif -Q -Cvel.cpt -V

However, I keep receiving the following (in verbose mode):

grdimage [INFORMATION]: File geotiff.geo.tif reads with GDAL driver GTiff  
grdimage [INFORMATION]: Round-off patrol changed geographic grid increment for latitude from 0.014999999999999996 to 0.0149999999999999994  
grdimage [INFORMATION]: Read header from file geotiff.geo.tif  
grdimage [INFORMATION]: File geotiff.geo.tif reads with GDAL driver GTiff  
grdimage [INFORMATION]: Round-off patrol changed geographic grid increment for latitude from 0.014999999999999996 to 0.0149999999999999994  
grdimage [INFORMATION]: Central meridian not given, default to 53.5  
grdimage [INFORMATION]: Map scale is 153.393 km per cm or 1:1.53393e+07.  
grdimage [INFORMATION]: Allocate and read data from file geotiff.geo.tif  
grdimage [INFORMATION]: Reading grid from file geotiff.geo.tif  
grdimage [INFORMATION]: Read band(s): 1  
grdimage [INFORMATION]: Set boundary condition for left edge: natural  
grdimage [INFORMATION]: project grid files  
grdimage [INFORMATION]: Grid projection from size 1361x1038 to 1361x1038  
grdimage [INFORMATION]: gmt\_grd\_project: Output grid extrema [-inf/inf] exceed extrema of input grid [-inf/60.7006] due to resampling  
grdimage [INFORMATION]: gmt\_grd\_project: See option -n+c to clip resampled output range to given input range  
double free or corruption (out)  
./geotiff\_plot.gmt: line 34: 21041 Aborted (core dumped) gmt grdimage geotiff.geo.tif -Q -Cvel.cpt -V

Is there a fix for this, or is it related to how I produced the tiff in matlab?

Thanks,  
Jess

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [July 7, 2022, 2:44pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-aborted-due-to-double-free-or-corruption-out/3095/2 "2022-07-07T14:44:21Z")

</div>

Can you post a small geotiff image that reproduces the issue (make a zip out of it and attach it to the post)

---

<div class="post-metadata">

**Author:** ![eejap](https://avatars.discourse-cdn.com/v4/letter/e/f04885/32.png) [@eejap](https://forum.generic-mapping-tools.org/u/eejap)\
**Post date:** [July 8, 2022, 8:32am UTC](https://forum.generic-mapping-tools.org/t/grdimage-aborted-due-to-double-free-or-corruption-out/3095/3 "2022-07-08T08:32:04Z")

</div>

I have gotten around the issue by using matlab to convert the tif to a grd file:

% load input tif  
[lon,lat,data,~,~] = read\_geotiff(in\_file);

% write output grd  
grdwrite2(lon,lat,data,out\_file);

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [July 8, 2022, 1:34pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-aborted-due-to-double-free-or-corruption-out/3095/4 "2022-07-08T13:34:51Z")

</div>

OK, but that does not help us fixing the crash.

---

<div class="post-metadata">

**Author:** ![eejap](https://avatars.discourse-cdn.com/v4/letter/e/f04885/32.png) [@eejap](https://forum.generic-mapping-tools.org/u/eejap)\
**Post date:** [July 14, 2022, 8:01am UTC](https://forum.generic-mapping-tools.org/t/grdimage-aborted-due-to-double-free-or-corruption-out/3095/5 "2022-07-14T08:01:13Z")

</div>

The compressed geotiff is too large to attach but can be found at this link: [https://drive.google.com/drive/folders/1v4ZA8m85t1fbZXiqWicxkvwEnBzltTym?usp=sharing](https://drive.google.com/drive/folders/1v4ZA8m85t1fbZXiqWicxkvwEnBzltTym?usp=sharing)

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [July 14, 2022, 11:32am UTC](https://forum.generic-mapping-tools.org/t/grdimage-aborted-due-to-double-free-or-corruption-out/3095/6 "2022-07-14T11:32:40Z")

</div>

What is your GMT version? I can plot that file with no problems.

---

<div class="post-metadata">

**Author:** ![eejap](https://avatars.discourse-cdn.com/v4/letter/e/f04885/32.png) [@eejap](https://forum.generic-mapping-tools.org/u/eejap)\
**Post date:** [July 14, 2022, 12:20pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-aborted-due-to-double-free-or-corruption-out/3095/7 "2022-07-14T12:20:42Z")

</div>

I am using GMT 6.1.0 64 bit on RHEL 8 OS

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [July 14, 2022, 12:43pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-aborted-due-to-double-free-or-corruption-out/3095/8 "2022-07-14T12:43:52Z")

</div>

Ah, you should have said that before. Bug reports (almost) only make sense when using latest version. And that bug has been fixed.
