Ken Thomases : winecoreaudio: Don't CFAllocate buffer for port message.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jun 1 06:49:05 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 1612ce86596ca455b97337f3ea34e122070b6a14
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=1612ce86596ca455b97337f3ea34e122070b6a14

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed May 24 05:45:14 2006 -0500

winecoreaudio: Don't CFAllocate buffer for port message.

---

 dlls/winmm/winecoreaudio/audio.c |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/dlls/winmm/winecoreaudio/audio.c b/dlls/winmm/winecoreaudio/audio.c
index df6bdc8..8b232a5 100644
--- a/dlls/winmm/winecoreaudio/audio.c
+++ b/dlls/winmm/winecoreaudio/audio.c
@@ -301,31 +301,23 @@ static DWORD WINAPI messageThread(LPVOID
 static DWORD wodSendDriverCallbackMessage(WINE_WAVEOUT* wwo, WORD wMsg, DWORD dwParam1, DWORD dwParam2)
 {
     CFDataRef data;
-    UInt32 *buffer;
+    UInt32 buffer[4];
     SInt32 ret;
     
     CFMessagePortRef messagePort;
     messagePort = CFMessagePortCreateRemote(kCFAllocatorDefault, MessageThreadPortName);
         
-    buffer = CFAllocatorAllocate(NULL, sizeof(UInt32) * 4, 0);
-    if (!buffer)
-        return 0;
-    
     buffer[0] = (UInt32) wwo->woID;
     buffer[1] = (UInt32) wMsg;
     buffer[2] = (UInt32) dwParam1;
     buffer[3] = (UInt32) dwParam2;
-    
-    data = CFDataCreate(kCFAllocatorDefault, (UInt8 *)buffer, sizeof(UInt32) * 4);
+
+    data = CFDataCreate(kCFAllocatorDefault, (UInt8 *)buffer, sizeof(buffer));
     if (!data)
-    {
-        CFAllocatorDeallocate(NULL, buffer);
         return 0;
-    }
     
     ret = CFMessagePortSendRequest(messagePort, kWaveOutCallbackMessage, data, 0.0, 0.0, NULL, NULL);
     CFRelease(data);
-    CFAllocatorDeallocate(NULL, buffer);
     CFRelease(messagePort);
     
     return (ret == kCFMessagePortSuccess)?1:0;




More information about the wine-cvs mailing list