[Bug 783978] New: utils/registrychunks: Fix leaks in failed cases

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Tue Jun 20 01:01:45 UTC 2017


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

            Bug ID: 783978
           Summary: utils/registrychunks: Fix leaks in failed cases
    Classification: Platform
           Product: GStreamer
           Version: unspecified
                OS: Mac OS
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: heekyoung.seo at lge.com
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

[Case 1] gstutils.c

Regression overflow checking failed case in gst_calculate_linear_regression
function, newx is not freed before return FALSE.

  /* have to do this precisely otherwise the results are pretty much useless.
   * should guarantee that none of these accumulators can overflow */

  /* quantities on the order of 1e10 to 1e13 -> 30-35 bits;
   * window size a max of 2^10, so
   this addition could end up around 2^45 or so -- ample headroom */
  for (i = j = 0; i < n; i++, j += 2) {
    /* Just in case assumptions about headroom prove false, let's check */
    if ((newx[j] > 0 && G_MAXUINT64 - xbar <= newx[j]) ||
        (newy[j] > 0 && G_MAXUINT64 - ybar <= newy[j])) {
      GST_CAT_WARNING (GST_CAT_CLOCK,
          "Regression overflowed in clock slaving! xbar %"
          G_GUINT64_FORMAT " newx[j] %" G_GUINT64_FORMAT " ybar %"
          G_GUINT64_FORMAT " newy[j] %" G_GUINT64_FORMAT, xbar, newx[j], ybar,
          newy[j]);
+      if (temp == NULL && n > 64)
+        g_free (newx);
       return FALSE;
     }


[Case 2] gstregistrychunk.c
unpack_string failed case in gst_registry_chunks_load_plugin_dep_strv function,
arr is not freed before return.

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");
+  g_strfreev (arr);
   return NULL;
 }

-- 
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