[Bug 765794] New: Memory leak in gstreamer gst/gstregistrychunks.c

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Fri Apr 29 05:17:19 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=765794

            Bug ID: 765794
           Summary: Memory leak in gstreamer gst/gstregistrychunks.c
    Classification: Platform
           Product: GStreamer
           Version: git master
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: srivastava.d at samsung.com
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

Hi,

I found memory leak in below mentioned file and function mentioned below.
Inside while loop, if the macro "unpack_string" send control
to goto lable "fail" if _len == -1. And from there function is returning
without free allocated memory of "arr".
Please suggest your opinion.

And another issue I think is output of g_new0 is not checked anywhere for NULL
in case of memory allocation fails.

file: gstreamer/gst/gstregistrychunks.c:731

macro: 

#define unpack_string(inptr, outptr, endptr, error_label)  G_STMT_START{\
  gint _len = _strnlen (inptr, (endptr-inptr)); \
  if (_len == -1) \
    goto error_label; \
  outptr = g_memdup ((gconstpointer)inptr, _len + 1); \
  inptr += _len + 1; \
}G_STMT_END

function: static gchar **
gst_registry_chunks_load_plugin_dep_strv (gchar ** in, gchar * end, guint n)
{
  gchar **arr;

  if (n == 0)
    return NULL;

  arr = g_new0 (gchar *, n + 1);
  while (n > 0) {
    unpack_string (*in, arr[n - 1], end, fail);
    --n;
  }
  return arr;
fail:
  GST_INFO ("Reading plugin dependency strings failed");
  return NULL;
}

Thanks

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list