Re: [PATCH 1/5] util: convenience function to create gmime stream for stdout

  • From: David Bremner <david@xxxxxxxxxxx>
  • To: notmuch@xxxxxxxxxxxxxxx, notmuch@xxxxxxxxxxxxx
  • Date: Sun, 21 May 2017 10:28:47 -0300

David Bremner <david@xxxxxxxxxxx> writes:

+GMimeStream *
+g_mime_stream_stdout_new()
+{
+    GMimeStream *stream_stdout = NULL;
+
+    stream_stdout = g_mime_stream_pipe_new (STDOUT_FILENO);
+    if (!stream_stdout)
+     return NULL;
+
+    g_mime_stream_pipe_set_owner (GMIME_STREAM_PIPE (stream_stdout), FALSE);
+
+    return g_mime_stream_buffer_new (stream_stdout, 
GMIME_STREAM_BUFFER_BLOCK_WRITE);
+}

speaking of memory leaks, I _think_ stream_stdout is leaking here,
although I can't find it with valgrind.

Other related posts: