After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 739368 - gl: small memory leak in gl shader
gl: small memory leak in gl shader
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal minor
: 1.4.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-10-29 18:27 UTC by Luis de Bethencourt
Modified: 2014-11-03 00:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix (870 bytes, patch)
2014-10-29 18:27 UTC, Luis de Bethencourt
none Details | Review
consolidate into g_strdup_printf() (1.23 KB, patch)
2014-10-31 15:34 UTC, Luis de Bethencourt
committed Details | Review
Might as well use g_strcmp0 () then as well. (1.27 KB, patch)
2014-10-31 15:38 UTC, Luis de Bethencourt
rejected Details | Review

Description Luis de Bethencourt 2014-10-29 18:27:22 UTC
Created attachment 289605 [details] [review]
fix

CID #1212171 Resource leak

Memory is only freed in one side of the if. Not pretty but adding a g_free in the FALSE clause.
Comment 1 Luis de Bethencourt 2014-10-29 18:28:13 UTC
Code around it for easier review.

>      if (arraysize) {
>        char *s = g_malloc (strlen (vartype) + 32);
>        sprintf (s, "%s[%d]", vartype, arraysize);
>        if (strcmp (t, s)) {
>          g_free (s);
>          goto parse_error;
>        }
>        g_free (s);
>      } else {
Comment 2 Tim-Philipp Müller 2014-10-31 14:51:18 UTC
Looks good to me, but perhaps the g_malloc + sprintf should be consolidated into a g_strdup_printf() ?
Comment 3 Luis de Bethencourt 2014-10-31 15:34:42 UTC
Created attachment 289750 [details] [review]
consolidate into g_strdup_printf()

Good idea, consolidated.
Comment 4 Luis de Bethencourt 2014-10-31 15:38:29 UTC
Created attachment 289751 [details] [review]
Might as well use g_strcmp0 () then as well.
Comment 5 Tim-Philipp Müller 2014-10-31 15:51:38 UTC
Why? None of the two arguments will ever be NULL.
Comment 6 Luis de Bethencourt 2014-10-31 16:02:59 UTC
Because it feels weird to use strcmp when one of the parameters is a gchar. But I understand that the only difference between the two functions is that g_strcmp0 handles NULL gracefully.

I can merge attachment 289750 [details] [review]. Don't really mind.
Comment 7 Luis de Bethencourt 2014-11-01 15:55:10 UTC
Comment on attachment 289750 [details] [review]
consolidate into g_strdup_printf()

Merged

commit 658f403a26c2242852a8c130bc5779c4268b2cae
Comment 8 Luis de Bethencourt 2014-11-01 15:55:49 UTC
Comment on attachment 289751 [details] [review]
Might as well use g_strcmp0 () then as well.

No need for g_strcmp0 ()
Comment 9 Luis de Bethencourt 2014-11-01 15:56:14 UTC
Thanks Tim! :)