summaryrefslogtreecommitdiff
path: root/0001-Fix-a-memory-leak-on-the-error-path-in-XpGetLocaleNe.patch
diff options
context:
space:
mode:
Diffstat (limited to '0001-Fix-a-memory-leak-on-the-error-path-in-XpGetLocaleNe.patch')
-rw-r--r--0001-Fix-a-memory-leak-on-the-error-path-in-XpGetLocaleNe.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/0001-Fix-a-memory-leak-on-the-error-path-in-XpGetLocaleNe.patch b/0001-Fix-a-memory-leak-on-the-error-path-in-XpGetLocaleNe.patch
new file mode 100644
index 0000000..ba0b80a
--- /dev/null
+++ b/0001-Fix-a-memory-leak-on-the-error-path-in-XpGetLocaleNe.patch
@@ -0,0 +1,37 @@
+From a1e1a7b0b9a7bcededfc9166df58541675615699 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Tue, 16 Oct 2018 12:39:26 -0400
+Subject: [PATCH] Fix a memory leak on the error path in XpGetLocaleNetString
+
+After Data() we own the pointer again, so we can just free it before
+getting the reply.
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+ src/XpPrinter.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/XpPrinter.c b/src/XpPrinter.c
+index 03b18c4..4e8cdc9 100644
+--- a/src/XpPrinter.c
++++ b/src/XpPrinter.c
+@@ -118,14 +118,14 @@ XpGetPrinterList (
+ if (req->localeLen)
+ Data( dpy, (char *) locale, (long) req->localeLen );
+
++ XFree(locale);
++
+ if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return ( (XPPrinterList) NULL ); /* error */
+ }
+
+- XFree(locale);
+-
+ *list_count = rep.listCount;
+
+ if (*list_count) {
+--
+2.19.0
+