1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2026-01-26 21:41:34 +03:00

shell: free cmdline before continue

This patch frees the cmdline when it's not empty but it doesn't contain
any actual character.

If the cmdline is just whitespaces or \r and \n, the loop continues
without freeing the cmdline string, so it's a leak.

Fix https://gitlab.gnome.org/GNOME/libxml2/-/issues/1009
This commit is contained in:
Daniel Garcia Moreno
2025-10-23 07:41:19 +02:00
committed by Daniel Garcia Moreno
parent 76a6ba4c41
commit 160c8a43ba

View File

@@ -1138,8 +1138,11 @@ xmllintShell(xmlDoc *doc, const char *filename, FILE * output)
command[i++] = *cur++;
}
command[i] = 0;
if (i == 0)
if (i == 0) {
free(cmdline);
cmdline = NULL;
continue;
}
/*
* Parse the argument