File pacemaker-libcrmcommon-avoid-memory-leak-when-schema-transform-not-found.patch of Package pacemaker.10377
commit d2c2bf04693899dcfe79be024faf72f02adfb419
Author: Ken Gaillot <kgaillot@redhat.com>
Date: Fri Mar 2 09:48:28 2018 -0600
Low: libcrmcommon: avoid memory leak when schema transform not found
Index: pacemaker-1.1.18+20180126.bfe4e8042/lib/common/schemas.c
===================================================================
--- pacemaker-1.1.18+20180126.bfe4e8042.orig/lib/common/schemas.c
+++ pacemaker-1.1.18+20180126.bfe4e8042/lib/common/schemas.c
@@ -301,7 +301,6 @@ crm_schema_init(void)
// Shouldn't be possible, but makes static analysis happy
crm_err("Skipping schema '%s': could not parse version",
namelist[lpc]->d_name);
- free(namelist[lpc]);
continue;
}
if ((lpc + 1) < max) {
@@ -331,9 +330,13 @@ crm_schema_init(void)
}
add_schema(schema_validator_rng, &version, NULL, NULL, transform,
next);
- free(namelist[lpc]);
free(transform);
}
+
+ for (lpc = 0; lpc < max; lpc++) {
+ free(namelist[lpc]);
+ }
+ free(namelist);
}
/* 1.1 was the old name for -next */
@@ -345,7 +348,6 @@ crm_schema_init(void)
add_schema(schema_validator_none, &zero, "none",
"N/A", NULL, -1);
- free(namelist);
}
static gboolean