summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2014-06-20 21:05:33 +0100
committerDaniel Veillard <veillard@redhat.com>2014-07-26 20:11:35 +0800
commit7746f2f60982889cd836fc23022e426f5a02d883 (patch)
tree8ed6bad60ec9d4c40225b29fc757a02996ca724d
parent579ebbcb3c5a0da78d255f46df15a862d1f82604 (diff)
downloadlibxml2-7746f2f60982889cd836fc23022e426f5a02d883.tar.gz
xmlcatalog: Fix a memory leak on quit
Coverity issue: #60442 https://bugzilla.gnome.org/show_bug.cgi?id=731990
-rw-r--r--xmlcatalog.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/xmlcatalog.c b/xmlcatalog.c
index 43f455a6..b9ed6a48 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");