ifcfg: fix invalid free in parse_route_line()

Cannot free NM_PTRARRAY_EMPTY(). Discovered by coverity.

Fixes: 6d675a943b
This commit is contained in:
Thomas Haller 2017-10-30 16:35:01 +01:00
parent 62a57dab49
commit d0d962d3d1

View file

@ -589,7 +589,8 @@ parse_route_line (const char *line,
GError **error)
{
nm_auto_ip_route_unref NMIPRoute *route = NULL;
gs_free const char **words = NULL;
gs_free const char **words_free = NULL;
const char *const*words;
const char *s;
gsize i_words;
guint i;
@ -653,10 +654,9 @@ parse_route_line (const char *line,
* Maybe later we want to support some form of quotation here.
* Which of course, would be incompatible with initscripts.
*/
words = nm_utils_strsplit_set (line, " \t\n");
words_free = nm_utils_strsplit_set (line, " \t\n");
if (!words)
words = (const char **) NM_PTRARRAY_EMPTY (const char *);
words = words_free ?: NM_PTRARRAY_EMPTY (const char *);
for (i_words = 0; words[i_words]; ) {
const gsize i_words0 = i_words;