[xmlsec] check returned value - Coverity complains (Simo Sorce, Red Hat)



commit fc1a9a2cd9d50e636141fc44219ac4712a4473a8
Author: Aleksey Sanin <aleksey aleksey com>
Date:   Wed Jun 4 09:02:41 2014 -0700

    check returned value - Coverity complains (Simo Sorce, Red Hat)

 src/keyinfo.c |   11 ++++++++++-
 src/xmldsig.c |   24 ++++++++++++++++++++----
 2 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/src/keyinfo.c b/src/keyinfo.c
index 00390fa..61ef2bb 100644
--- a/src/keyinfo.c
+++ b/src/keyinfo.c
@@ -761,7 +761,16 @@ xmlSecKeyDataNameXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
 
     /* finally set key name if it is not there */
     if(xmlSecKeyGetName(key) == NULL) {
-        xmlSecKeySetName(key, newName);
+        ret = xmlSecKeySetName(key, newName);
+        if(ret < 0) {
+            xmlSecError(XMLSEC_ERRORS_HERE,
+                        xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+                        "xmlSecKeySetName",
+                        XMLSEC_ERRORS_R_XMLSEC_FAILED,
+                        XMLSEC_ERRORS_NO_MESSAGE);
+            xmlFree(newName);
+            return(-1);
+        }
     }
     xmlFree(newName);
     return(0);
diff --git a/src/xmldsig.c b/src/xmldsig.c
index b08b8b1..b452161 100644
--- a/src/xmldsig.c
+++ b/src/xmldsig.c
@@ -160,10 +160,26 @@ xmlSecDSigCtxInitialize(xmlSecDSigCtxPtr dsigCtx, xmlSecKeysMngrPtr keysMngr) {
     }
 
     /* references lists from SignedInfo and Manifest elements */
-    xmlSecPtrListInitialize(&(dsigCtx->signedInfoReferences),
-                            xmlSecDSigReferenceCtxListId);
-    xmlSecPtrListInitialize(&(dsigCtx->manifestReferences),
-                            xmlSecDSigReferenceCtxListId);
+    ret = xmlSecPtrListInitialize(&(dsigCtx->signedInfoReferences),
+                                  xmlSecDSigReferenceCtxListId);
+    if(ret != 0) {
+        xmlSecError(XMLSEC_ERRORS_HERE,
+                    NULL,
+                    "xmlSecPtrListInitialize",
+                    XMLSEC_ERRORS_R_XMLSEC_FAILED,
+                    XMLSEC_ERRORS_NO_MESSAGE);
+        return(ret);
+    }
+    ret = xmlSecPtrListInitialize(&(dsigCtx->manifestReferences),
+                                  xmlSecDSigReferenceCtxListId);
+    if(ret != 0) {
+        xmlSecError(XMLSEC_ERRORS_HERE,
+                    NULL,
+                    "xmlSecPtrListInitialize",
+                    XMLSEC_ERRORS_R_XMLSEC_FAILED,
+                    XMLSEC_ERRORS_NO_MESSAGE);
+        return(ret);
+    }
 
     dsigCtx->enabledReferenceUris = xmlSecTransformUriTypeAny;
     return(0);


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