avprotocol: fix leak in error code paths

https://bugzilla.gnome.org/show_bug.cgi?id=788481
This commit is contained in:
Ashish Kumar 2017-10-03 13:57:24 +05:30 committed by Tim-Philipp Müller
parent c086dc4dcf
commit a323802c5b

View file

@ -244,6 +244,7 @@ gst_ffmpegdata_open (GstPad * pad, int flags, AVIOContext ** context)
/* we don't support R/W together */ /* we don't support R/W together */
if ((flags & AVIO_FLAG_WRITE) && (flags & AVIO_FLAG_READ)) { if ((flags & AVIO_FLAG_WRITE) && (flags & AVIO_FLAG_READ)) {
GST_WARNING ("Only read-only or write-only are supported"); GST_WARNING ("Only read-only or write-only are supported");
g_free (info);
return -EINVAL; return -EINVAL;
} }
@ -262,6 +263,7 @@ gst_ffmpegdata_open (GstPad * pad, int flags, AVIOContext ** context)
buffer = av_malloc (buffer_size); buffer = av_malloc (buffer_size);
if (buffer == NULL) { if (buffer == NULL) {
GST_WARNING ("Failed to allocate buffer"); GST_WARNING ("Failed to allocate buffer");
g_free (info);
return -ENOMEM; return -ENOMEM;
} }
@ -270,6 +272,7 @@ gst_ffmpegdata_open (GstPad * pad, int flags, AVIOContext ** context)
gst_ffmpegdata_read, gst_ffmpegdata_write, gst_ffmpegdata_seek); gst_ffmpegdata_read, gst_ffmpegdata_write, gst_ffmpegdata_seek);
if (*context == NULL) { if (*context == NULL) {
GST_WARNING ("Failed to allocate memory"); GST_WARNING ("Failed to allocate memory");
g_free (info);
av_free (buffer); av_free (buffer);
return -ENOMEM; return -ENOMEM;
} }