Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix memory leak #256

Merged
merged 2 commits into from

2 participants

@yuusuke

I revised the memory leak that I discovered using valgrind.
Please merge, if there is no problem in correction.

yusuke added some commits
yusuke Fix: fixed a memory leak in lrmd.
==32476== 20,960 bytes in 10 blocks are definitely lost in loss record 42 of 42
==32476==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==32476==    by 0x4E63364: resources_action_create (services.c:106)
==32476==    by 0x404419: lrmd_rsc_dispatch (lrmd.c:858)
==32476==    by 0x4C4A762: crm_trigger_dispatch (mainloop.c:105)
==32476==    by 0x3476438F0D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.5)
==32476==    by 0x347643C937: ??? (in /lib64/libglib-2.0.so.0.2200.5)
==32476==    by 0x347643CD54: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.5)
==32476==    by 0x4023C7: main (main.c:303)
237ca70
yusuke Fix: fixed a memory leak in crmd.
an example:
==4281==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==4281==    by 0x567E70A: crm_ipc_prepare (ipc.c:484)
==4281==    by 0x568043A: crm_ipc_send (ipc.c:1008)
==4281==    by 0x419819: do_pe_invoke_callback (pengine.c:286)
==4281==    by 0x524D5E3: cib_native_callback (cib_utils.c:736)
==4281==    by 0x52538A6: cib_native_dispatch_internal (cib_native.c:120)
==4281==    by 0x569AB6F: mainloop_gio_callback (mainloop.c:585)
==4281==    by 0x3476438F0D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.5)
==4281==    by 0x347643C937: ??? (in /lib64/libglib-2.0.so.0.2200.5)
==4281==    by 0x347643CD54: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.5)
==4281==    by 0x40526D: crmd_init (main.c:154)
==4281==    by 0x405598: main (main.c:120)
6946f9b
@beekhof
Owner

Strange that node of the regression tests found this :-/

@beekhof beekhof merged commit e81387f into ClusterLabs:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 13, 2013
  1. Fix: fixed a memory leak in lrmd.

    yusuke authored
    ==32476== 20,960 bytes in 10 blocks are definitely lost in loss record 42 of 42
    ==32476==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
    ==32476==    by 0x4E63364: resources_action_create (services.c:106)
    ==32476==    by 0x404419: lrmd_rsc_dispatch (lrmd.c:858)
    ==32476==    by 0x4C4A762: crm_trigger_dispatch (mainloop.c:105)
    ==32476==    by 0x3476438F0D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.5)
    ==32476==    by 0x347643C937: ??? (in /lib64/libglib-2.0.so.0.2200.5)
    ==32476==    by 0x347643CD54: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.5)
    ==32476==    by 0x4023C7: main (main.c:303)
  2. Fix: fixed a memory leak in crmd.

    yusuke authored
    an example:
    ==4281==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
    ==4281==    by 0x567E70A: crm_ipc_prepare (ipc.c:484)
    ==4281==    by 0x568043A: crm_ipc_send (ipc.c:1008)
    ==4281==    by 0x419819: do_pe_invoke_callback (pengine.c:286)
    ==4281==    by 0x524D5E3: cib_native_callback (cib_utils.c:736)
    ==4281==    by 0x52538A6: cib_native_dispatch_internal (cib_native.c:120)
    ==4281==    by 0x569AB6F: mainloop_gio_callback (mainloop.c:585)
    ==4281==    by 0x3476438F0D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.5)
    ==4281==    by 0x347643C937: ??? (in /lib64/libglib-2.0.so.0.2200.5)
    ==4281==    by 0x347643CD54: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.5)
    ==4281==    by 0x40526D: crmd_init (main.c:154)
    ==4281==    by 0x405598: main (main.c:120)
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +3 −0  lib/common/ipc.c
  2. +1 −0  lib/services/services.c
View
3  lib/common/ipc.c
@@ -1082,6 +1082,9 @@ crm_ipc_send(crm_ipc_t * client, xmlNode * message, enum crm_ipc_flags flags, in
crm_info("Request was %.120s", buffer);
}
+ free(header);
+ free(iov[1].iov_base);
+ free(iov);
free(buffer);
return rc;
}
View
1  lib/services/services.c
@@ -311,6 +311,7 @@ services_action_free(svc_action_t * op)
free(op->opaque->args[i]);
}
+ free(op->opaque);
free(op->rsc);
free(op->action);
Something went wrong with that request. Please try again.