FunctionFlip icon indicating copy to clipboard operation
FunctionFlip copied to clipboard

Fix memory leaks and integer mismatches identified by Clang static analyzer

Open ZevEisenberg opened this issue 4 years ago • 3 comments

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 to IOServiceGetMatchingServices, 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.

ZevEisenberg avatar Aug 03 '19 15:08 ZevEisenberg

Thanks @ZevEisenberg! I will take a close look and get this merged by later this month.

kevingessner avatar Aug 04 '19 15:08 kevingessner

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.

ZevEisenberg avatar Aug 04 '19 19:08 ZevEisenberg

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!

bcaplan avatar Jun 08 '21 17:06 bcaplan