diff options
Diffstat (limited to 'schematron.c')
-rw-r--r-- | schematron.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/schematron.c b/schematron.c index 35a1447e..5946986f 100644 --- a/schematron.c +++ b/schematron.c @@ -1508,11 +1508,12 @@ xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt, int size; size = snprintf(NULL, 0, "%0g", eval->floatval); - buf = (xmlChar*) malloc(size); - /* xmlStrPrintf(buf, size, "%0g", eval->floatval); // doesn't work */ - sprintf((char*) buf, "%0g", eval->floatval); - ret = xmlStrcat(ret, buf); - free(buf); + buf = (xmlChar *) xmlMalloc(size + 1); + if (buf != NULL) { + snprintf((char *) buf, size + 1, "%0g", eval->floatval); + ret = xmlStrcat(ret, buf); + xmlFree(buf); + } break; } case XPATH_STRING: |