summaryrefslogtreecommitdiff
path: root/debian/patches/0043-xmlcatalog-Fix-a-memory-leak-on-quit.patch
blob: c0151db98903b3f2f14618b5e95a8168a9d0892d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From: Philip Withnall <philip.withnall@collabora.co.uk>
Date: Fri, 20 Jun 2014 21:05:33 +0100
Subject: xmlcatalog: Fix a memory leak on quit

Coverity issue: #60442

https://bugzilla.gnome.org/show_bug.cgi?id=731990
---
 xmlcatalog.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xmlcatalog.c b/xmlcatalog.c
index 43f455a..b9ed6a4 100644
--- a/xmlcatalog.c
+++ b/xmlcatalog.c
@@ -181,12 +181,13 @@ static void usershell(void) {
 	/*
 	 * start interpreting the command
 	 */
-        if (!strcmp(command, "exit"))
-	    break;
-        if (!strcmp(command, "quit"))
-	    break;
-        if (!strcmp(command, "bye"))
+	if (!strcmp(command, "exit") ||
+	    !strcmp(command, "quit") ||
+	    !strcmp(command, "bye")) {
+	    free(cmdline);
 	    break;
+	}
+
 	if (!strcmp(command, "public")) {
 	    if (nbargs != 1) {
 		printf("public requires 1 arguments\n");