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 476849 - Invocation of the interface "g_hook_free" fails in certain conditions
Invocation of the interface "g_hook_free" fails in certain conditions
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.14.x
Other Linux
: Normal critical
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2007-09-14 09:51 UTC by Areg Beketovski
Modified: 2007-09-19 20:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The test case reproducing the bug. (235 bytes, text/plain)
2007-09-14 09:53 UTC, Areg Beketovski
  Details
Proposed patch, fixing the problem (377 bytes, patch)
2007-09-14 09:55 UTC, Areg Beketovski
committed Details | Review

Description Areg Beketovski 2007-09-14 09:51:12 UTC
Steps to reproduce:
1. Invocation of the interface g_hook_free fails if "finalize_hook" member of the struct GHookList is set to NULL. According to the documentation of the interface g_hook_free: Calls the GHookList hook_free function if it exists, and frees the memory allocated for the GHook. In this excerpt the phrase "hook_free function" should be read as "finalize_hook function", since the actual interface called in the source code is the "finalize_hook", while the "hook_free" identifier is not used anywhere in the code.


Stack trace:
  • #0 ??
  • #1 g_hook_free
    from /opt/gnome/lib64/libglib-2.0.so.0
  • #2 main
    at /home/user/lsb_test.c line 9

Other information:

The detailed bug description can be found at: 

http://linuxtesting.org/results/report?num=D0002
Comment 1 Areg Beketovski 2007-09-14 09:53:53 UTC
Created attachment 95579 [details]
The test case reproducing the bug.
Comment 2 Areg Beketovski 2007-09-14 09:55:56 UTC
Created attachment 95580 [details] [review]
Proposed patch, fixing the problem
Comment 3 Areg Beketovski 2007-09-17 04:45:39 UTC
Comment on attachment 95580 [details] [review]
Proposed patch, fixing the problem

--- glib-2.14.0/glib/ghook.c
+++ glib-2.14.0-fixed/glib/ghook.c
@@ -130,7 +130,8 @@ g_hook_free (GHookList *hook_list,
   g_return_if_fail (G_HOOK_IS_UNLINKED (hook));
   g_return_if_fail (!G_HOOK_IN_CALL (hook));

-  hook_list->finalize_hook (hook_list, hook);
+  if(hook_list->finalize_hook != NULL)
+      hook_list->finalize_hook (hook_list, hook);
   g_slice_free1 (hook_list->hook_size, hook);
 }
Comment 4 Matthias Clasen 2007-09-19 05:52:56 UTC
Patch looks fine.
Comment 5 Behdad Esfahbod 2007-09-19 20:36:49 UTC
2007-09-19  Behdad Esfahbod  <behdad@gnome.org>

        * glib/ghook.c (g_hook_free): Check for NULL finalizer. (#476849, Areg
        Beketovski)