+2004-06-08 Wim Taymans <wim@fluendo.com>
+
+ * gst/tcp/gsttcp.c: (gst_tcp_gdp_read_header),
+ (gst_tcp_gdp_read_caps), (gst_tcp_gdp_write_header),
+ (gst_tcp_gdp_write_caps):
+ * gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get):
+ * gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_gdp_read_caps),
+ (gst_tcpserversrc_gdp_read_header), (gst_tcpserversrc_get):
+ Memory leak fixes
+
2004-06-08 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/vorbis/Makefile.am:
GstBuffer *buffer;
header = g_malloc (header_length);
-
readsize = header_length;
GST_DEBUG_OBJECT (this, "Reading %d bytes for buffer packet header",
/* if we read 0 bytes, and we're blocking, we hit eos */
if (ret == 0) {
GST_DEBUG ("blocking read returns 0, EOS");
+ g_free (header);
gst_element_set_eos (GST_ELEMENT (this));
return GST_DATA (gst_event_new (GST_EVENT_EOS));
}
if (ret < 0) {
GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+ g_free (header);
return NULL;
}
if (ret != readsize) {
GST_DEBUG_OBJECT (this, "validated buffer packet header");
buffer = gst_dp_buffer_from_header (header_length, header);
+ g_free (header);
GST_DEBUG_OBJECT (this, "created new buffer %p from packet header", buffer);
return GST_DATA (buffer);
gchar *string;
header = g_malloc (header_length);
-
readsize = header_length;
+
GST_LOG_OBJECT (this, "Reading %d bytes for caps packet header", readsize);
ret = read (socket, header, readsize);
if (ret < 0) {
+ g_free (header);
GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
return NULL;
}
caps = gst_dp_caps_from_packet (header_length, header, payload);
string = gst_caps_to_string (caps);
GST_DEBUG_OBJECT (this, "retrieved GDP caps from packet payload: %s", string);
+ g_free (string);
g_free (header);
g_free (payload);
- g_free (string);
+
return caps;
}
GST_LOG_OBJECT (this, "writing %d bytes for GDP buffer header", length);
wrote = gst_tcp_socket_write (socket, header, length);
+ g_free (header);
if (wrote != length) {
if (fatal)
GST_ELEMENT_ERROR (this, RESOURCE, WRITE,
GST_LOG_OBJECT (this, "writing %d bytes for GDP caps header", length);
wrote = gst_tcp_socket_write (socket, header, length);
if (wrote != length) {
+ g_free (header);
+ g_free (payload);
if (fatal)
GST_ELEMENT_ERROR (this, RESOURCE, WRITE,
(_("Error while sending gdp header data to \"%s:%d\"."), host, port),
}
length = gst_dp_header_payload_length (header);
+ g_free (header);
GST_LOG_OBJECT (this, "writing %d bytes for GDP caps payload", length);
wrote = gst_tcp_socket_write (socket, payload, length);
+ g_free (payload);
if (wrote != length) {
if (fatal)
GST_ELEMENT_ERROR (this, RESOURCE, WRITE,
ret = read (this->client_sock_fd, header, readsize);
if (ret < 0) {
GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+ g_free (header);
return NULL;
}
g_assert (ret == readsize);
if (ret < 0) {
GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
g_free (header);
+ g_free (payload);
return NULL;
}
g_assert (ret == readsize);
caps = gst_dp_caps_from_packet (header_length, header, payload);
string = gst_caps_to_string (caps);
GST_DEBUG_OBJECT (this, "retrieved GDP caps from packet payload: %s", string);
+ g_free (string);
g_free (header);
g_free (payload);
- g_free (string);
+
return caps;
}
GstBuffer *buffer;
header = g_malloc (header_length);
-
readsize = header_length;
+
GST_LOG_OBJECT (this, "Reading %d bytes for buffer packet header", readsize);
ret = read (this->client_sock_fd, header, readsize);
/* if we read 0 bytes, and we're blocking, we hit eos */
if (ret == 0) {
GST_DEBUG ("blocking read returns 0, EOS");
gst_element_set_eos (GST_ELEMENT (this));
+ g_free (header);
return GST_DATA (gst_event_new (GST_EVENT_EOS));
}
if (ret < 0) {
GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+ g_free (header);
return NULL;
}
if (ret != readsize) {
readsize);
if (ret < 0) {
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+ gst_buffer_unref (buf);
return NULL;
}