rfbsrc: fix rfbdecoder new/free asymetry and wrong free in error case

If rfb_decoder_new() allocates the decoder sructure, rfb_decoder_free()
should free the structure. We should not free the decoder when an
error occurs during connection - it holds lots of configuration/state
and will be freed later in finalize.
This commit is contained in:
Tim-Philipp Müller 2013-05-11 00:36:06 +01:00
parent 14d20271c1
commit 4cfa3f5af3
2 changed files with 2 additions and 2 deletions

View file

@ -201,7 +201,6 @@ gst_rfb_src_finalize (GObject * object)
} }
if (src->decoder) { if (src->decoder) {
rfb_decoder_free (src->decoder); rfb_decoder_free (src->decoder);
g_free (src->decoder);
src->decoder = NULL; src->decoder = NULL;
} }
@ -434,7 +433,6 @@ gst_rfb_src_start (GstBaseSrc * bsrc)
if (!rfb_decoder_connect_tcp (decoder, src->host, src->port)) { if (!rfb_decoder_connect_tcp (decoder, src->host, src->port)) {
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
("Could not connect to host %s on port %d", src->host, src->port)); ("Could not connect to host %s on port %d", src->host, src->port));
rfb_decoder_free (decoder);
return FALSE; return FALSE;
} }

View file

@ -88,6 +88,8 @@ rfb_decoder_free (RfbDecoder * decoder)
if (decoder->data) if (decoder->data)
g_free (decoder->data); g_free (decoder->data);
g_free (decoder);
} }
gboolean gboolean