From sgrubb at redhat.com  Thu Jul 20 23:06:52 2017
From: sgrubb at redhat.com (Steve Grubb)
Date: Thu, 20 Jul 2017 17:06:52 -0400
Subject: [Rd] [PATCH] Fix memory leak in PicTeXDeviceDriver
Message-ID: <5314894.YKaiI5FJ7Q@x2>

Hello,

This patch fixes a memory leak due to ptd going out of scope
before its assigned to dd.

Signed-off-by: Steve Grubb <sgrubb at redhat.com>

Index: src/library/grDevices/src/devPicTeX.c
===================================================================
--- src/library/grDevices/src/devPicTeX.c	(revision 72935)
+++ src/library/grDevices/src/devPicTeX.c	(working copy)
@@ -665,8 +665,10 @@
     ptd->width = width;
     ptd->height = height;
 
-    if( ! PicTeX_Open(dd, ptd) ) 
+    if( ! PicTeX_Open(dd, ptd) ) {
+        free(ptd);
 	return FALSE;
+    }
 
     /* Base Pointsize */
     /* Nominal Character Sizes in Pixels */



[Rd] [PATCH] Fix memory leak in PicTeXDeviceDriver
Steve Grubb