g_hash_table_new_full is my recommendation also.


On Sun, May 5, 2013 at 3:54 PM, Matthew Fusaro <notifications@github.com>wrote:

> In libvmi/events.c:
>
> > @@ -128,6 +133,24 @@ status_t vmi_register_event (vmi_instance_t vmi,
> >              }
> >
> >              break;
> > +        case VMI_EVENT_SINGLESTEP:
> > +            for(;vcpu<vmi->num_vcpus;vcpu++) {
> > +                if(CHECK_VCPU_SINGLESTEP(event->ss_event, vcpu)) {
> > +                    if(NULL!=g_hash_table_lookup(vmi->ss_events, &vcpu)) {
> > +                        dbprint("An event is already registered on this vcpu: %u\n", vcpu);
> > +                    } else {
> > +                        if(VMI_SUCCESS == driver_start_single_step(vmi, event->ss_event)){
> > +                            vcpu_i = malloc(sizeof(uint32_t));
>
> Yeah I'd rather not leak anything. I think i would rather just move to
> g_hash_table_new_full() in events_init() and just supply a key destroy
> function instead of adding another member to the struct.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/bdpayne/libvmi/pull/46/files#r4087435>
> .
>