[libxml2] Avoid crash if allocation fails



commit 717042d2ae21e36c5efda8d2e64fc88385095503
Author: Daniel Veillard <veillard redhat com>
Date:   Mon Jul 22 14:28:20 2013 +0800

    Avoid crash if allocation fails
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704527
    xmlSchemaNewValue() may fail on OOM error

 xmlschemastypes.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index a9edc03..ec403e8 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -242,6 +242,10 @@ xmlSchemaNewMinLengthFacet(int value)
     }
     ret->type = XML_SCHEMA_FACET_MINLENGTH;
     ret->val = xmlSchemaNewValue(XML_SCHEMAS_NNINTEGER);
+    if (ret->val == NULL) {
+        xmlFree(ret);
+       return(NULL);
+    }
     ret->val->value.decimal.lo = value;
     return (ret);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]