Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Øyvind Harboe
On Fri, Dec 10, 2010 at 9:28 AM, Peter Stuge pe...@stuge.se wrote: Øyvind Harboe wrote: Two versions attached. I'll leave it to you to decide which is the best way to implement this I prefer the longer but simpler to read one. Were it mostly a smaller my own project then I'd gone with the

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Spencer Oliver
On 10/12/2010 08:34, Øyvind Harboe wrote: On Fri, Dec 10, 2010 at 9:28 AM, Peter Stugepe...@stuge.se wrote: Øyvind Harboe wrote: Two versions attached. I'll leave it to you to decide which is the best way to implement this I prefer the longer but simpler to read one. Were it mostly a

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Paul Richards
On 2010/12/10 17:34, Øyvind Harboe wrote: I think optimizing for testability readability is the way to go here. Especially considering the evidence that this code doesn't get tested a whole lot I can verify that both solutions work. I'm OK with whichever solution you guys choose since

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Paul Richards
On 2010/12/10 18:46, Spencer Oliver wrote: Not looked into it but why do we not just duplicate the existing unregister event/timer functions - or are they broken aswell? They (the target versions) don't appear to have the same problem. The only difference I can see is that the

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Andreas Fritiofson
On Fri, Dec 10, 2010 at 4:16 PM, Paul Richards paulr...@gmail.com wrote: On 2010/12/10 18:46, Spencer Oliver wrote: Not looked into it but why do we not just duplicate the existing unregister event/timer functions - or are they broken aswell? They (the target versions) don't appear to have

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Peter Stuge
Andreas Fritiofson wrote: Now there's 3 versions to choose from :-) It's not too late. The target versions seems nice and readable. And correct, as far as I can see this late hour. I think the jtag version should follow the behavior of these and only remove the first matching handler. That

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Andreas Fritiofson
On Fri, Dec 10, 2010 at 11:39 PM, Peter Stuge pe...@stuge.se wrote: Andreas Fritiofson wrote: Now there's 3 versions to choose from :-) It's not too late. The target versions seems nice and readable. And correct, as far as I can see this late hour. I think the jtag version should follow the

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Paul Richards
On 2010/12/11 8:20, Andreas Fritiofson wrote: I don't know. But, generally, if I _can_ register the same handler twice, I'd expect each registration to require a separate unregister call. The actual call sites would have to be inspected before changing this behavior, of course. There shouldn't

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Peter Stuge
Paul Richards wrote: Peter, note that the double pointers are in the target list function implementations (that would be copied), are you ok with this? Afraid not. The alternative is quite straightforward, so I would strongly prefer not going there. Thanks! //Peter

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Paul Richards
On 2010/12/11 13:00, Peter Stuge wrote: Afraid not. The alternative is quite straightforward, so I would strongly prefer not going there. Thought as much :-) Well, will leave it up to you guys to decide. I can test any new patches required. Cheers, Paul

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-10 Thread Peter Stuge
Peter Stuge wrote: The alternative is quite straightforward, so I would strongly prefer not going there. Allow me to clarify that; The alternative of rewriting to use no double pointers makes the code much more straightforward, so I would strongly prefer not using any double pointers. :)

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-09 Thread Øyvind Harboe
Merged. Thanks! -- Øyvind Harboe Can Zylin Consulting help on your project? US toll free 1-866-980-3434 / International +47 51 63 25 00 http://www.zylin.com/zy1000.html ARM7 ARM9 ARM11 XScale Cortex JTAG debugger and flash programmer ___

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-09 Thread Peter Stuge
Øyvind Harboe wrote: Merged. So I should have complained more loudly. The double pointers are horrible. //Peter ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-09 Thread Øyvind Harboe
On Fri, Dec 10, 2010 at 8:05 AM, Peter Stuge pe...@stuge.se wrote: Øyvind Harboe wrote: Merged. So I should have complained more loudly. The double pointers are horrible. Ah, missed that. Well another patch is gladly accepted, meanwhile it no longer crashes. Hopefully the fact that I

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-09 Thread Peter Stuge
Øyvind Harboe wrote: double pointers are horrible. Ah, missed that. Well another patch is gladly accepted, meanwhile it no longer crashes. Fair. Two versions attached. One which makes the code two lines longer and avoids double pointers, and a remix which uses only a single double pointer

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-09 Thread Øyvind Harboe
On Fri, Dec 10, 2010 at 8:27 AM, Peter Stuge pe...@stuge.se wrote: Øyvind Harboe wrote: double pointers are horrible. Ah, missed that. Well another patch is gladly accepted, meanwhile it no longer crashes. Fair. Two versions attached. One which makes the code two lines longer and avoids

Re: [Openocd-development] [PATCH] Fix for segmentation fault from freed memory access in jtag_unregister_event_callback()

2010-12-08 Thread Paul Richards
On 2010/12/08 16:27, Peter Stuge wrote: The priv comparison logic is reversed. Sorry, can't believe that snuck in, thanks. The code is horrible. (Certainly not your fault!) Sorry if that's offensive to the original author. The variable names do not help. Will this work: int