GNOME Bugzilla – Bug 783978
utils/registrychunks: Fix leaks in failed cases
Last modified: 2017-06-20 07:57:44 UTC
[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; }
Created attachment 354074 [details] [review] utils/registrychunk: Fix leaks in failed cases
Comment on attachment 354074 [details] [review] utils/registrychunk: Fix leaks in failed cases Please attach this as two separate patches to this bug, thanks!
Created attachment 354079 [details] [review] registrychunk: Fix leak in failed case of reading plugin dependency string
Created attachment 354080 [details] [review] utils: Fix leak in failed case of regression overflow checking
(In reply to Sebastian Dröge (slomo) from comment #2) > Comment on attachment 354074 [details] [review] [review] > utils/registrychunk: Fix leaks in failed cases > > Please attach this as two separate patches to this bug, thanks! Dear Sabastian, I attached as two separate patches to this bug again. Thank you.
Attachment 354079 [details] pushed as d32afe3 - registrychunk: Fix leak in failed case of reading plugin dependency string Attachment 354080 [details] pushed as c30c39b - utils: Fix leak in failed case of regression overflow checking