wnaspi32: Replace malloc with HeapAlloc.

Michael Stefaniuc mstefani at redhat.de
Fri Dec 5 00:48:19 CST 2008


---
 dlls/wnaspi32/winaspi16.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/wnaspi32/winaspi16.c b/dlls/wnaspi32/winaspi16.c
index 4209082..17d6a6c 100644
--- a/dlls/wnaspi32/winaspi16.c
+++ b/dlls/wnaspi32/winaspi16.c
@@ -252,7 +252,7 @@ ASPI_ExecScsiCmd(DWORD ptrPRB, UINT16 mode)
   if (HOST_TO_TARGET(lpPRB)) {
     /* send header, command, and then data */
     in_len = SCSI_OFF + lpPRB->SRB_CDBLen + lpPRB->SRB_BufLen;
-    sg_hd = (struct sg_header *) malloc(in_len);
+    sg_hd = HeapAlloc(GetProcessHeap(), 0, in_len);
     memset(sg_hd, 0, SCSI_OFF);
     memcpy(sg_hd + 1, &lpPRB->CDBByte[0], lpPRB->SRB_CDBLen);
     if (lpPRB->SRB_BufLen) {
@@ -262,20 +262,20 @@ ASPI_ExecScsiCmd(DWORD ptrPRB, UINT16 mode)
   else {
     /* send header and command - no data */
     in_len = SCSI_OFF + lpPRB->SRB_CDBLen;
-    sg_hd = (struct sg_header *) malloc(in_len);
+    sg_hd = HeapAlloc(GetProcessHeap(), 0, in_len);
     memset(sg_hd, 0, SCSI_OFF);
     memcpy(sg_hd + 1, &lpPRB->CDBByte[0], lpPRB->SRB_CDBLen);
   }
 
   if (TARGET_TO_HOST(lpPRB)) {
     out_len = SCSI_OFF + lpPRB->SRB_BufLen;
-    sg_reply_hdr = (struct sg_header *) malloc(out_len);
+    sg_reply_hdr = HeapAlloc(GetProcessHeap(), 0, out_len);
     memset(sg_reply_hdr, 0, SCSI_OFF);
     sg_hd->reply_len = out_len;
   }
   else {
     out_len = SCSI_OFF;
-    sg_reply_hdr = (struct sg_header *) malloc(out_len);
+    sg_reply_hdr = HeapAlloc(GetProcessHeap(), 0, out_len);
     memset(sg_reply_hdr, 0, SCSI_OFF);
     sg_hd->reply_len = out_len;
   }
@@ -343,8 +343,8 @@ ASPI_ExecScsiCmd(DWORD ptrPRB, UINT16 mode)
     }
   }
 
-  free(sg_reply_hdr);
-  free(sg_hd);
+  HeapFree(GetProcessHeap(), 0, sg_reply_hdr);
+  HeapFree(GetProcessHeap(), 0, sg_hd);
   ASPI_DebugPrintResult(lpPRB, mode);
   return SS_COMP;
 
@@ -362,8 +362,8 @@ error_exit:
    * We probably should set lpPRB->SRB_TargStat, SRB_HaStat ?
    */
   WARN("error_exit\n");
-  free(sg_reply_hdr);
-  free(sg_hd);
+  HeapFree(GetProcessHeap(), 0, sg_reply_hdr);
+  HeapFree(GetProcessHeap(), 0, sg_hd);
   return lpPRB->SRB_Status;
 }
 #endif
-- 
1.6.0.rc1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20081205/7a3f5297/attachment.pgp 


More information about the wine-patches mailing list