Commit b5040bce authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfreadwrite/writer: Make sure output pointer is initialized.

parent debf5d85
......@@ -1299,8 +1299,18 @@ static void test_sink_writer(void)
hr = MFCreateSinkWriterFromURL(NULL, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
writer = (void *)0xdeadbeef;
hr = MFCreateSinkWriterFromURL(NULL, NULL, NULL, &writer);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!writer, "Unexpected pointer %p.\n", writer);
hr = MFCreateSinkWriterFromMediaSink(NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
writer = (void *)0xdeadbeef;
hr = MFCreateSinkWriterFromMediaSink(NULL, NULL, &writer);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(!writer, "Unexpected pointer %p.\n", writer);
}
START_TEST(mfplat)
......
......@@ -186,6 +186,11 @@ HRESULT create_sink_writer_from_sink(IMFMediaSink *sink, IMFAttributes *attribut
struct sink_writer *object;
HRESULT hr;
*out = NULL;
if (!sink)
return E_INVALIDARG;
object = malloc(sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
......@@ -205,6 +210,9 @@ HRESULT WINAPI MFCreateSinkWriterFromMediaSink(IMFMediaSink *sink, IMFAttributes
{
TRACE("%p, %p, %p.\n", sink, attributes, writer);
if (!writer)
return E_INVALIDARG;
return create_sink_writer_from_sink(sink, attributes, &IID_IMFSinkWriter, (void **)writer);
}
......@@ -289,6 +297,8 @@ HRESULT create_sink_writer_from_url(const WCHAR *url, IMFByteStream *bytestream,
CLSID clsid;
HRESULT hr;
*out = NULL;
if (!url && !bytestream)
return E_INVALIDARG;
......@@ -332,5 +342,8 @@ HRESULT WINAPI MFCreateSinkWriterFromURL(const WCHAR *url, IMFByteStream *bytest
{
TRACE("%s, %p, %p, %p.\n", debugstr_w(url), bytestream, attributes, writer);
if (!writer)
return E_INVALIDARG;
return create_sink_writer_from_url(url, bytestream, attributes, &IID_IMFSinkWriter, (void **)writer);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment