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 649508 - StTextureCache: plug leak in not-found icon case
StTextureCache: plug leak in not-found icon case
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-05-05 20:31 UTC by Colin Walters
Modified: 2011-05-24 17:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
StTextureCache: plug leak in not-found icon case (2.17 KB, patch)
2011-05-05 20:32 UTC, Colin Walters
committed Details | Review
StTextureCache: Fix leak of key string (1.95 KB, patch)
2011-05-24 17:01 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2011-05-05 20:31:57 UTC
==13810== 44 bytes in 1 blocks are definitely lost in loss record 12,513 of 18,765
==13810==    at 0x4006D69: malloc (vg_replace_malloc.c:236)
==13810==    by 0x5191BCA: standard_malloc (gmem.c:88)
==13810==    by 0x519201F: g_malloc (gmem.c:164)
==13810==    by 0x51A9C2A: g_strdup (gstrfuncs.c:102)
==13810==    by 0x40624D5: load_gicon_with_colors (st-texture-cache.c:1157)
==13810==    by 0x4030E50: shell_app_info_create_icon_texture (shell-app-system.c:1359)
==13810==    by 0x4C2771BF: ffi_call (ffi.c:326)
==13810==    by 0x7D56A37: gjs_invoke_c_function (function.c:638)
==13810==    by 0x7D57A48: function_call (function.c:884)
==13810==    by 0x426A64A: js::Invoke(JSContext*, js::CallArgs const&, unsigned int) (in /src/build/jhbuild/lib/libmozjs185.so.1.0.0)
==13810==    by 0x42570F5: js::Interpret(JSContext*, JSStackFrame*, unsigned int, JSInterpMode) (in /src/build/jhbuild/lib/libmozjs185.so.1.0.0)
==13810==    by 0x426A07F: js::RunScript(JSContext*, JSScript*, JSStackFrame*) (in /src/build/jhbuild/lib/libmozjs185.so.1.0.0)
Comment 1 Colin Walters 2011-05-05 20:32:00 UTC
Created attachment 187320 [details] [review]
StTextureCache: plug leak in not-found icon case
Comment 2 drago01 2011-05-07 08:57:54 UTC
Review of attachment 187320 [details] [review]:

Looks good.
Comment 3 Colin Walters 2011-05-11 20:17:35 UTC
Attachment 187320 [details] pushed as dcd07eb - StTextureCache: plug leak in not-found icon case
Comment 4 Owen Taylor 2011-05-24 04:44:09 UTC
The applied patch makes the two branches of the if statement inconsistent, and thus cannot be fully correct.

  if (info != NULL)
    {
      request->key = g_strdup (key);
      [...]
    }
  else
    {
      g_free (request->key);
    }

From my reading this change was correct but we always leak the initial setting of request->key in the _found_ case, so the assignment to request->key in the found case should be removed but please double check that.
Comment 5 Colin Walters 2011-05-24 17:01:02 UTC
Created attachment 188483 [details] [review]
StTextureCache: Fix leak of key string

Also micro-optimize by avoiding another strdup(), instead pass
ownership of the string when we can.
Comment 6 Owen Taylor 2011-05-24 17:06:33 UTC
Review of attachment 188483 [details] [review]:

Looks right to me
Comment 7 Colin Walters 2011-05-24 17:16:10 UTC
Attachment 188483 [details] pushed as fdefb31 - StTextureCache: Fix leak of key string