[3/6] imagehlp: Implement ImageRemoveCertificate

Jacek Caban jacek at codeweavers.com
Wed Dec 2 13:33:13 CST 2009


Hi Owen,

Owen Rudge wrote:
> ---
>  dlls/imagehlp/integrity.c       |   73 
> +++++++++++++++++++++++++++++++++++++--
>  dlls/imagehlp/tests/integrity.c |    4 +-
>  2 files changed, 72 insertions(+), 5 deletions(-)

+        cert_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, data_size);
+
+        if (!cert_data)
+            return FALSE;
+
+        ret = SetFilePointer(FileHandle, offset + cert_size_padded, NULL, FILE_BEGIN);
+
+        if (ret == INVALID_SET_FILE_POINTER)
+            return FALSE;
+
+        /* Read any subsequent certificates */
+        r = ReadFile(FileHandle, cert_data, data_size, &count, NULL);
+
+        if ((!r) || (count != data_size))
+            return FALSE;
+
+        SetFilePointer(FileHandle, offset, NULL, FILE_BEGIN);
+
+        /* Write them one index back */
+        r = WriteFile(FileHandle, cert_data, data_size, &count, NULL);
+
+        if ((!r) || (count != data_size))
+            return FALSE;
+
+        HeapFree(GetProcessHeap(), 0, cert_data);


You leak cert_data on errors here.


Jacek



More information about the wine-devel mailing list