wmp: Use CRT allocation functions.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2022-04-07 10:53:06 +03:00 committed by Alexandre Julliard
parent 0448e1f78f
commit 00291118db
4 changed files with 29 additions and 48 deletions

View File

@ -152,7 +152,7 @@ static ULONG WINAPI EnumConnections_Release(IEnumConnections *iface)
if(!ref) {
IConnectionPoint_Release(&This->cp->IConnectionPoint_iface);
heap_free(This);
free(This);
}
return ref;
@ -296,10 +296,9 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *
}
if(i == This->sinks_size)
This->sinks = heap_realloc(This->sinks,
(++This->sinks_size)*sizeof(*This->sinks));
This->sinks = realloc(This->sinks, (++This->sinks_size)*sizeof(*This->sinks));
}else {
This->sinks = heap_alloc(sizeof(*This->sinks));
This->sinks = malloc(sizeof(*This->sinks));
This->sinks_size = 1;
i = 0;
}
@ -333,7 +332,7 @@ static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface,
TRACE("(%p)->(%p)\n", This, ppEnum);
ret = heap_alloc(sizeof(*ret));
ret = malloc(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
@ -370,14 +369,14 @@ static void ConnectionPoint_Destroy(ConnectionPoint *This)
IDispatch_Release(This->sinks[i]);
}
heap_free(This->sinks);
heap_free(This);
free(This->sinks);
free(This);
}
static void ConnectionPoint_Create(REFIID riid, ConnectionPoint **cp,
IConnectionPointContainer *container)
{
ConnectionPoint *ret = heap_alloc(sizeof(ConnectionPoint));
ConnectionPoint *ret = malloc(sizeof(ConnectionPoint));
ret->IConnectionPoint_iface.lpVtbl = &ConnectionPointVtbl;

View File

@ -20,7 +20,6 @@
#include "olectl.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(wmp);
@ -307,7 +306,7 @@ static ULONG WINAPI OleObject_Release(IOleObject *iface)
release_client_site(This);
destroy_player(This);
ConnectionPointContainer_Destroy(This);
heap_free(This);
free(This);
}
return ref;
@ -890,7 +889,7 @@ HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory *iface, IUnknown *outer,
TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
wmp = heap_alloc_zero(sizeof(*wmp));
wmp = calloc(1, sizeof(*wmp));
if(!wmp)
return E_OUTOFMEMORY;

View File

@ -1741,9 +1741,9 @@ static ULONG WINAPI WMPMedia_Release(IWMPMedia *iface)
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) {
heap_free(This->url);
heap_free(This->name);
heap_free(This);
free(This->url);
free(This->name);
free(This);
}
return ref;
@ -1815,8 +1815,8 @@ static HRESULT WINAPI WMPMedia_put_name(IWMPMedia *iface, BSTR name)
if (!name) return E_POINTER;
heap_free(This->name);
This->name = heap_strdupW(name);
free(This->name);
This->name = wcsdup(name);
return S_OK;
}
@ -1990,9 +1990,9 @@ static ULONG WINAPI WMPPlaylist_Release(IWMPPlaylist *iface)
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) {
heap_free(This->url);
heap_free(This->name);
heap_free(This);
free(This->url);
free(This->name);
free(This);
}
return ref;
@ -2060,8 +2060,8 @@ static HRESULT WINAPI WMPPlaylist_put_name(IWMPPlaylist *iface, BSTR name)
if (!name) return E_POINTER;
heap_free(This->name);
This->name = heap_strdupW(name);
free(This->name);
This->name = wcsdup(name);
return S_OK;
}
@ -2282,7 +2282,7 @@ HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia)
HRESULT hr;
WCHAR *name_dup;
media = heap_alloc_zero(sizeof(*media));
media = calloc(1, sizeof(*media));
if (!media)
return E_OUTOFMEMORY;
@ -2290,20 +2290,20 @@ HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia)
if (url)
{
media->url = heap_strdupW(url);
name_dup = heap_strdupW(url);
media->url = wcsdup(url);
name_dup = wcsdup(url);
hr = CreateUri(name_dup, Uri_CREATE_ALLOW_RELATIVE | Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, &uri);
if (FAILED(hr))
{
heap_free(name_dup);
free(name_dup);
IWMPMedia_Release(&media->IWMPMedia_iface);
return hr;
}
hr = IUri_GetPath(uri, &path);
if (hr != S_OK)
{
heap_free(name_dup);
free(name_dup);
IUri_Release(uri);
IWMPMedia_Release(&media->IWMPMedia_iface);
return hr;
@ -2323,8 +2323,8 @@ HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia)
}
else
{
media->url = heap_strdupW(L"");
media->name = heap_strdupW(L"");
media->url = wcsdup(L"");
media->name = wcsdup(L"");
}
media->duration = duration;
@ -2343,13 +2343,13 @@ HRESULT create_playlist(BSTR name, BSTR url, LONG count, IWMPPlaylist **ppPlayli
{
WMPPlaylist *playlist;
playlist = heap_alloc_zero(sizeof(*playlist));
playlist = calloc(1, sizeof(*playlist));
if (!playlist)
return E_OUTOFMEMORY;
playlist->IWMPPlaylist_iface.lpVtbl = &WMPPlaylistVtbl;
playlist->url = heap_strdupW(url ? url : L"");
playlist->name = heap_strdupW(name ? name : L"");
playlist->url = wcsdup(url ? url : L"");
playlist->name = wcsdup(name ? name : L"");
playlist->ref = 1;
playlist->count = count;

View File

@ -19,7 +19,6 @@
#define COBJMACROS
#include "windows.h"
#include "wine/heap.h"
#include "ole2.h"
#include "dshow.h"
#include "wmp.h"
@ -129,22 +128,6 @@ void unregister_player_msg_class(void) DECLSPEC_HIDDEN;
extern HINSTANCE wmp_instance DECLSPEC_HIDDEN;
static inline WCHAR *heap_strdupW(const WCHAR *str)
{
WCHAR *ret;
if(str) {
size_t size = lstrlenW(str)+1;
ret = heap_alloc(size*sizeof(WCHAR));
if(ret)
memcpy(ret, str, size*sizeof(WCHAR));
}else {
ret = NULL;
}
return ret;
}
static inline HRESULT return_bstr(const WCHAR *value, BSTR *p)
{
if(!p)