libXp/0001-Fix-a-memory-leak-on-the-error-path-in-XpGetLocaleNe.patch

38 lines
970 B
Diff
Raw Permalink Normal View History

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