From: <and...@us...> - 2013-12-10 23:52:22
|
Revision: 12840 http://sourceforge.net/p/plplot/code/12840 Author: andrewross Date: 2013-12-10 23:52:18 +0000 (Tue, 10 Dec 2013) Log Message: ----------- Fix up a number of valgrind warnings in some of the examples. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/examples/c++/x14.cc trunk/examples/c++/x22.cc trunk/examples/c++/x31.cc trunk/examples/f95/x04f.f90 Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2013-12-10 23:49:29 UTC (rev 12839) +++ trunk/examples/c/x04c.c 2013-12-10 23:52:18 UTC (rev 12840) @@ -125,7 +125,10 @@ line_styles[0] = 1; line_widths[0] = 1.; // note from the above opt_array the first symbol (and box) indices - // do not have to be specified + // do not have to be specified, at least in C. For Fortran we need + // to set the symbols to be something, since the string is always + // copied as part of the bindings. + symobols[0] = ""; // Second legend entry. opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; Modified: trunk/examples/c++/x14.cc =================================================================== --- trunk/examples/c++/x14.cc 2013-12-10 23:49:29 UTC (rev 12839) +++ trunk/examples/c++/x14.cc 2013-12-10 23:52:18 UTC (rev 12840) @@ -435,6 +435,10 @@ pls->col0( 1 ); pls->lab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); pls->flush(); + +// Clean up + pls->Free2dGrid( z, xpts, ypts ); + pls->Free2dGrid( w, xpts, ypts ); } Modified: trunk/examples/c++/x22.cc =================================================================== --- trunk/examples/c++/x22.cc 2013-12-10 23:49:29 UTC (rev 12839) +++ trunk/examples/c++/x22.cc 2013-12-10 23:52:18 UTC (rev 12840) @@ -405,7 +405,6 @@ pls->Free2dGrid( v, nx, ny ); delete pls; - exit( 0 ); } int main( int argc, const char ** argv ) Modified: trunk/examples/c++/x31.cc =================================================================== --- trunk/examples/c++/x31.cc 2013-12-10 23:49:29 UTC (rev 12839) +++ trunk/examples/c++/x31.cc 2013-12-10 23:52:18 UTC (rev 12840) @@ -31,6 +31,7 @@ class x31 { public: x31( int, const char** ); + int status; private: plstream *pls; @@ -63,7 +64,6 @@ PLINT g1[] = { 255, 0 }; PLINT b1[] = { 0, 0 }; PLFLT a1[] = { 1.0, 1.0 }; - int status; char fnam[256]; pls = new plstream(); @@ -289,12 +289,15 @@ delete pls; - exit( status ); } int main( int argc, const char **argv ) { + int status; + x31 *x = new x31( argc, argv ); + status = x->status; delete x; + return status; } Modified: trunk/examples/f95/x04f.f90 =================================================================== --- trunk/examples/f95/x04f.f90 2013-12-10 23:49:29 UTC (rev 12839) +++ trunk/examples/f95/x04f.f90 2013-12-10 23:52:18 UTC (rev 12840) @@ -102,7 +102,10 @@ line_styles(1) = 1 line_widths(1) = 1 ! note from the above opt_array the first symbol (and box) indices -! do not have to be specified +! do not have to be specified, at least in C. For Fortran we need +! to set the symbols to be something, since the string is always +! copied as part of the bindings. + symbols(1) = '' ! Second legend entry. opt_array(2) = PL_LEGEND_LINE + PL_LEGEND_SYMBOL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |