diff options
author | nyamatongwe <nyamatongwe@gmail.com> | 2011-11-09 13:39:39 +1100 |
---|---|---|
committer | nyamatongwe <nyamatongwe@gmail.com> | 2011-11-09 13:39:39 +1100 |
commit | 2fce522eae48f7263df90a99c1fa0c7f7f89675b (patch) | |
tree | f219d08dd83983b5ae81706623ce33aef4159a4e /cocoa/ScintillaCocoa.mm | |
parent | 84607c2c9bbaf931b5e6907486ce276f65940ab0 (diff) | |
download | scintilla-mirror-2fce522eae48f7263df90a99c1fa0c7f7f89675b.tar.gz |
Fix potential memory problems found by analyze.
Diffstat (limited to 'cocoa/ScintillaCocoa.mm')
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 0b4fe6294..ccaa384f7 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -799,15 +799,15 @@ void ScintillaCocoa::AddToPopUp(const char *label, int cmd, bool enabled) [menu setOwner: this]; [menu setAutoenablesItems: NO]; - if (cmd == 0) + if (cmd == 0) { item = [NSMenuItem separatorItem]; - else - item = [[NSMenuItem alloc] init]; - + } else { + item = [[[NSMenuItem alloc] init] autorelease]; + [item setTitle: [NSString stringWithUTF8String: label]]; + } [item setTarget: menu]; [item setAction: @selector(handleCommand:)]; [item setTag: cmd]; - [item setTitle: [NSString stringWithUTF8String: label]]; [item setEnabled: enabled]; [menu addItem: item]; |