Fix memory leak on custom code 33/104833/1 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable accepted/tizen_3.0_common accepted/tizen_3.0_ivi accepted/tizen_3.0_mobile accepted/tizen_3.0_tv accepted/tizen_3.0_wearable tizen_3.0.m2 tizen_3.0_tv accepted/tizen/3.0.m2/mobile/20170105.025558 accepted/tizen/3.0.m2/tv/20170105.025705 accepted/tizen/3.0.m2/wearable/20170105.025751 accepted/tizen/3.0/common/20161215.164858 accepted/tizen/3.0/ivi/20161215.085619 accepted/tizen/3.0/mobile/20161215.085512 accepted/tizen/3.0/tv/20161215.085534 accepted/tizen/3.0/wearable/20161215.085553 submit/tizen_3.0.m2/20170104.093755 submit/tizen_3.0/20161214.084528
authorsangwan.kwon <sangwan.kwon@samsung.com>
Wed, 14 Dec 2016 11:04:27 +0000 (20:04 +0900)
committersangwan.kwon <sangwan.kwon@samsung.com>
Wed, 14 Dec 2016 11:04:27 +0000 (20:04 +0900)
* The result of xmlGetProp() should be free.
* See, http://xmlsoft.org/library.html

* It is different with below commit on tizen branch
* [c8d86331b65b3c290e7a1b3de7092d3a5a00b468]

Change-Id: Iffb19e18f45b1ac51acb70c22e279f709cad3751
Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
src/xmldsig.c

index db33058..19973d4 100644 (file)
@@ -980,21 +980,21 @@ xmlSecDSigCtxProcessReferences(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr firstReferen
                     return(-1);
                 }
 
-                xmlSecError(XMLSEC_ERRORS_HERE,
-                            NULL,
-                            NULL,
-                            XMLSEC_ERRORS_MAX_NUMBER,
-                            "Start to search reference on proxy : %s.",
-                            refUri);
-
                 xmlSecProxyCtxPtr pc = dsigCtx->proxyCtxPtr;
                 while(pc != NULL) {
                     if(xmlSecDecodeCmp(refUri, pc->cache) == 0) {
                         isInProxy = 1;
+                        xmlSecError(XMLSEC_ERRORS_HERE,
+                                    NULL,
+                                    NULL,
+                                    XMLSEC_ERRORS_MAX_NUMBER,
+                                    "Check [%s] on processing references.",
+                                    refUri);
                         break;
                     }
                     pc = pc->next;
                 }
+                xmlFree(refUri);
             } else {
                 /* if proxy is not exist, process references */
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1002,19 +1002,11 @@ xmlSecDSigCtxProcessReferences(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr firstReferen
                             NULL,
                             XMLSEC_ERRORS_MAX_NUMBER,
                             "Proxy doesn't exist.");
-                isInProxy = 1;
             }
 
             /* if not exist on proxy, skip on processing references */
-            if(isInProxy == 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE,
-                            NULL,
-                            NULL,
-                            XMLSEC_ERRORS_MAX_NUMBER,
-                            "Skip %s on processing references.",
-                            xmlGetProp(cur, xmlSecAttrURI));
+            if(isInProxy == 0)
                 continue;
-            }
         }
 
         /* create reference */