Bug #560

Error in `psscale': double free or corruption (fasttop)

Added by Eduardo about 3 years ago. Updated about 3 years ago.

Status:ClosedStart date:2014-05-13
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.x-svn Platform:Linux

Description

In GMT 5.1.2_r13125. The command is

psscale -D25/6/10/0.75 -Bcscale-annot.txt+u" m" -Cmacizo.cpt -O -Y-5 >> $ps

gfortran complains with this message:

*** Error in `psscale': double free or corruption (fasttop): 0x08fc8928 ***

running psscale with -Vd says:

psscale: Processing input CPT table
psscale: Object ID 0 : Registered CPT Table File macizo.cpt as an Input resource with geometry Non-Geographical [n_objects = 1]
psscale: GMTAPI_Begin_IO: Input resource access is now enabled [container]
psscale: GMTAPI_Import_CPT: Passed ID = 0 and mode = 0
psscale: Reading CPT table from File macizo.cpt
psscale: Reading CPT table from macizo.cpt
psscale: GMT_End_IO: Input resource access is now disabled
psscale:   CPT range from -220 to 3560
psscale: Projected values in meters: -220 3560 0 0.295276
psscale: Color bar will be plotted using colorimage
PSL: Too many colors to make colormap - using 24-bit direct color instead.
PSL: LZW inflated 485 to 516 bytes. No compression done.
*** Error in `psscale': double free or corruption (fasttop): 0x08fc8928 ***
psscale: GMT_Garbage_Collection: Destroying object: C=0 A=0 ID=0 W=Input F=CPT Table M=File S=Used P=0 D=8fed5e0 N=macizo.cpt
psscale: GMTAPI_Garbage_Collection freed 1 memory objects
psscale: GMTAPI_Unregister_IO: Unregistering object no 0 [n_objects = 0]
psscale: Entering GMT_Destroy_Session

Valgrind says:

==22122== Memcheck, a memory error detector
==22122== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==22122== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==22122== Command: psscale -D25/6/10/0.75 -Bcscale-annot.txt+u\ m -Cmacizo.cpt -O -Y-5
==22122== 
==22122== Invalid free() / delete / delete[] / realloc()
==22122==    at 0x4029DA8: free (vg_replace_malloc.c:468)
==22122==    by 0x418D6FF: GMT_plotend (gmt_plot.c:4055)
==22122==    by 0x42BD7B5: GMT_psscale (psscale.c:1291)
==22122==    by 0x407BB48: GMT_Call_Module (gmt_api.c:5979)
==22122==    by 0x8048BA2: main (gmt.c:178)
==22122==  Address 0xa7fb1c0 is 0 bytes inside a block of size 16 free'd
==22122==    at 0x4029DA8: free (vg_replace_malloc.c:468)
==22122==    by 0x418D6FF: GMT_plotend (gmt_plot.c:4055)
==22122==    by 0x42BD7B5: GMT_psscale (psscale.c:1291)
==22122==    by 0x407BB48: GMT_Call_Module (gmt_api.c:5979)
==22122==    by 0x8048BA2: main (gmt.c:178)
==22122== 
==22122== 
==22122== HEAP SUMMARY:
==22122==     in use at exit: 8,232 bytes in 5 blocks
==22122==   total heap usage: 1,723 allocs, 1,719 frees, 4,748,146 bytes allocated
==22122== 
==22122== LEAK SUMMARY:
==22122==    definitely lost: 16 bytes in 1 blocks
==22122==    indirectly lost: 0 bytes in 0 blocks
==22122==      possibly lost: 0 bytes in 0 blocks
==22122==    still reachable: 8,216 bytes in 4 blocks
==22122==         suppressed: 0 bytes in 0 blocks
==22122== Rerun with --leak-check=full to see details of leaked memory
==22122== 
==22122== For counts of detected and suppressed errors, rerun with: -v
==22122== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

scale-annot.txt Magnifier (266 Bytes) Eduardo, 2014-05-13 13:21

macizo.cpt (18.2 KB) Eduardo, 2014-05-13 13:21

Associated revisions

Revision 13176
Added by Paul about 3 years ago

Fix issue #560

History

#1 Updated by Paul about 3 years ago

  • Status changed from New to Resolved
  • Assignee set to Paul
  • % Done changed from 0 to 100

psscale is using a kludge by copying the x-axis info to the y-axis in order to do the vertical labeling but there was one structure member that was a pointer and those got messed up. Fixed in r13176.

#2 Updated by Eduardo about 3 years ago

  • RESOLVED ** tested with 5.1.2_r13201

#3 Updated by Paul about 3 years ago

  • Status changed from Resolved to Closed

We are closing this guy.

Also available in: Atom PDF