devenum: Use calloc() in moniker_create().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-04-11 10:49:42 -05:00 committed by Alexandre Julliard
parent 0fc7e99a15
commit 4994ba2123
1 changed files with 6 additions and 9 deletions

View File

@ -405,7 +405,7 @@ static ULONG WINAPI moniker_Release(IMoniker *iface)
if (ref == 0) { if (ref == 0) {
CoTaskMemFree(This->name); CoTaskMemFree(This->name);
CoTaskMemFree(This); free(This);
DEVENUM_UnlockModule(); DEVENUM_UnlockModule();
} }
return ref; return ref;
@ -770,20 +770,17 @@ static const IMonikerVtbl IMoniker_Vtbl =
struct moniker *moniker_create(void) struct moniker *moniker_create(void)
{ {
struct moniker *pMoniker; struct moniker *object;
pMoniker = CoTaskMemAlloc(sizeof(*pMoniker)); if (!(object = calloc(1, sizeof(*object))))
if (!pMoniker)
return NULL; return NULL;
pMoniker->IMoniker_iface.lpVtbl = &IMoniker_Vtbl; object->IMoniker_iface.lpVtbl = &IMoniker_Vtbl;
pMoniker->ref = 1; object->ref = 1;
pMoniker->has_class = FALSE;
pMoniker->name = NULL;
DEVENUM_LockModule(); DEVENUM_LockModule();
return pMoniker; return object;
} }
static inline EnumMonikerImpl *impl_from_IEnumMoniker(IEnumMoniker *iface) static inline EnumMonikerImpl *impl_from_IEnumMoniker(IEnumMoniker *iface)