FunctionFlip
FunctionFlip copied to clipboard
Fix memory leaks and integer mismatches identified by Clang static analyzer
Also modernized some Obj-C syntax.
Might address some of the leaks causing #9, but I haven't tested it. Not sure what the best way to profile the app is, since I don't understand the relationship between the preference pane and the helper. If you can tell me how to run in Instruments, I'd be happy to give it a look.
Static analysis warnings I didn't fix:
- non-localized strings
- unused variables. They aren't causing leaks, but I'd like to delete them if they really are just dead code.
- All three calls to
+[DDHidDevice allDevicesMatchingCFDictionary:withClass:skipZeroLocations:]
. The static analyzer complains that the match dictionary that is passed in may be leaked. However, the dictionary is passed toIOServiceGetMatchingServices
, which is documented to consume (i.e. release) the dictionary that is passed in. Not sure how to suppress the static analyzer, but as I understand it, this is not actually leaking.
Thanks @ZevEisenberg! I will take a close look and get this merged by later this month.
Great! My Objective-C is a little rusty, and the HID stuff is new for me, so I’m happy to make changes or discuss anything.
Any chance this can be merged and released soon? It seems like it's been in limbo for a while. I am also experiencing the memory leaks described in #9. Thanks in advance!