pnmenc: fix flow return and buffer leak in not-negotiated case

https://bugzilla.gnome.org/show_bug.cgi?id=729614
This commit is contained in:
Tim-Philipp Müller 2014-05-06 09:48:58 +01:00
parent 56db65d229
commit e807ac077d

View file

@ -112,10 +112,9 @@ gst_pnmenc_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
GstBuffer *out;
if ((s->info.width == 0) || (s->info.height == 0) || (s->info.fields == 0)) {
r = GST_FLOW_ERROR;
goto out;
}
if (s->info.width == 0 || s->info.height == 0 || s->info.fields == 0)
goto not_negotiated;
/* Assumption: One buffer, one image. That is, always first write header. */
header = g_strdup_printf ("P%i\n%i %i\n%i\n",
s->info.type + 3 * (1 - s->info.encoding), s->info.width, s->info.height,
@ -182,6 +181,12 @@ gst_pnmenc_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
out:
return r;
not_negotiated:
{
gst_buffer_unref (buf);
return GST_FLOW_NOT_NEGOTIATED;
}
}
static gboolean