mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1024226 - Fix leak of |buf| in nsIconChannel.cpp. r=jrmuizel
This commit is contained in:
parent
2b72007455
commit
76137e0f8d
@ -122,9 +122,19 @@ moz_gdk_pixbuf_to_channel(GdkPixbuf* aPixbuf, nsIURI *aURI,
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringInputStream> stream =
|
||||
do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Prevent the leaking of buf
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
NS_Free(buf);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// stream takes ownership of buf and will free it on destruction.
|
||||
// This function cannot fail.
|
||||
rv = stream->AdoptData((char*)buf, buf_size);
|
||||
|
||||
// If this no longer holds then re-examine buf's lifetime.
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = NS_NewInputStreamChannel(aChannel, aURI, stream,
|
||||
|
Loading…
Reference in New Issue
Block a user