Package: plotutils
Version: 2.6-15
Severity: normal
Tags: patch upstream

_pl_s_terminate() in libplot/s_defplot.c has an empty body, unlike every
other Plotter type, which calls _pl_g_terminate(). pl_deletepl_r() on an
SVG plotter therefore leaks the PlotterParams copies and the color name
cache (valgrind: 115 bytes definitely lost in 30 blocks).

Patch attached (debian/patches/43_svg-terminate-leak.patch); forwarded to
https://github.com/radfordneal/plotutils/pull/1
Description: SVGPlotter: call the generic terminate method
 _pl_s_terminate() had an empty body, while every other Plotter type chains
 up to _pl_g_terminate(). So pl_deletepl_r() on an SVG plotter leaked the
 Plotter's copies of the PlotterParams (_pl_g_copy_params_to_plotter) and
 the color name cache. Found with valgrind via LibreDWG's dwgplot.
Author: Reini Urban <[email protected]>
Forwarded: https://github.com/radfordneal/plotutils/pull/1
Last-Update: 2026-11-23

--- a/libplot/s_defplot.c
+++ b/libplot/s_defplot.c
@@ -191,6 +191,10 @@ _pl_s_terminate (S___(Plotter *_plotter)
 void
 _pl_s_terminate (S___(Plotter *_plotter))
 {
+  /* free the Plotter's copies of the class parameters and its color name
+     cache; every other Plotter type chains up to the generic terminate
+     method, but this one did not and so leaked them */
+  _pl_g_terminate (S___(_plotter));
 }
 
 #ifdef LIBPLOTTER

Reply via email to