[PATCH] crypt32: change salt allocation to handle errors (Coverity 133)

Marcus Meissner marcus at jet.franken.de
Thu May 7 17:00:01 CDT 2009


Hi,

Coverity 133 shows that a NULL ptr could escape here.

So move the data dump inside the if() where it is known
to be not NULL.

(Allocation errors are handled near the end of the function.)

Ciao, Marcus
---
 dlls/crypt32/protectdata.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/dlls/crypt32/protectdata.c b/dlls/crypt32/protectdata.c
index 401e820..e6ac16e 100644
--- a/dlls/crypt32/protectdata.c
+++ b/dlls/crypt32/protectdata.c
@@ -616,11 +616,9 @@ BOOL fill_protect_data(struct protect_data_t * pInfo, LPCWSTR szDataDescr,
             return FALSE;
         }
         pInfo->salt.cbData=CRYPT32_PROTECTDATA_SALT_LEN;
+        /* debug: show our salt */
+        TRACE_DATA_BLOB(&pInfo->salt);
     }
-
-    /* debug: show our salt */
-    TRACE_DATA_BLOB(&pInfo->salt);
-
     pInfo->cipher.cbData=0;
     pInfo->cipher.pbData=NULL;
 
-- 
1.5.6



More information about the wine-patches mailing list