2 This patch should fix memory leaks in tray-monitor.
3 Apply the patch to 1.36.2 with:
5 cd <bacula-source>/src/tray-monitor
6 patch -p0 <1.36.2-tray-monitor-memleak.patch
11 ===================================================================
12 RCS file: /cvsroot/bacula/bacula/src/tray-monitor/tray-monitor.c,v
13 retrieving revision 1.19
14 diff -r1.19 tray-monitor.c
16 > #define TRAY_DEBUG_MEMORY 0
19 < static POOLMEM *args;
23 > #if TRAY_DEBUG_MEMORY
24 > gpointer smt_malloc(gsize n_bytes) {
25 > return sm_malloc("GLib", sm_line, n_bytes);
28 > gpointer smt_realloc(gpointer mem, gsize n_bytes) {
29 > return sm_realloc("GLib", sm_line, mem, n_bytes);
32 > gpointer smt_calloc(gsize n_blocks,
33 > gsize n_block_bytes) {
34 > return sm_calloc("GLib", sm_line, n_blocks, n_block_bytes);
37 > void smt_free(gpointer mem) {
38 > sm_free("Glib", sm_line, mem);
43 > #if TRAY_DEBUG_MEMORY
44 > GMemVTable smvtable;
45 > smvtable.malloc = &smt_malloc;
46 > smvtable.realloc = &smt_realloc;
47 > smvtable.free = &smt_free;
48 > smvtable.calloc = &smt_calloc;
49 > smvtable.try_malloc = NULL;
50 > smvtable.try_realloc = NULL;
51 > g_mem_set_vtable(&smvtable);
55 < args = get_pool_memory(PM_FNAME);
57 < g_assert((xpm_generic_var[i] = (char*)g_malloc(strlen(xpm_generic[i])*sizeof(char))));
59 > g_assert((xpm_generic_var[i] = (char*)g_malloc((strlen(xpm_generic[i])+1)*sizeof(char))));
62 > g_source_remove(timerTag);
66 < free_pool_memory(args);
69 > gtk_object_destroy(GTK_OBJECT(window));
70 > gtk_object_destroy(GTK_OBJECT(mTrayMenu));
73 > #if TRAY_DEBUG_MEMORY
78 < GtkTextBuffer *newbuffer = gtk_text_buffer_new(NULL);
81 > #if TRAY_DEBUG_MEMORY
82 > printf("sm_line=%d\n", sm_line);
84 > GtkTextBuffer *newbuffer;
86 > newbuffer = gtk_text_buffer_new(NULL);
92 > g_object_unref(G_OBJECT(pixbuf));