From: <ai...@us...> - 2012-02-15 07:37:23
|
Revision: 12166 http://plplot.svn.sourceforge.net/plplot/?rev=12166&view=rev Author: airwin Date: 2012-02-15 07:37:17 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Improve handling of plcolorbar case where none of PL_COLORBAR_LABEL_(RIGHT|TOP|LEFT|BOTTOM) bits are specified for opt. In this case, the user wants no label on the colorbar so return immediately from draw_label. This fixes an uninitialized opt_label revealed by valgrind for examples/c/x16c -colorbar -dev psc Modified Paths: -------------- trunk/src/pllegend.c Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2012-02-10 22:03:53 UTC (rev 12165) +++ trunk/src/pllegend.c 2012-02-15 07:37:17 UTC (rev 12166) @@ -1147,8 +1147,6 @@ PLFLT parallel_height_mm = 0.0, perpendicular_height_mm = 0.0, default_mm, char_height_mm; - plgchr( &default_mm, &char_height_mm ); - // Only honor first bit in list of // PL_COLORBAR_LABEL_(RIGHT|TOP|LEFT|BOTTOM). if ( opt & PL_COLORBAR_LABEL_RIGHT ) @@ -1176,7 +1174,12 @@ else nlabel = 1; } + // If no label wanted, then return. + if ( nlabel == 0 ) + return; + plgchr( &default_mm, &char_height_mm ); + // Start preparing data to help plot the label or // calculate the corresponding bounding box changes. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |