summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDialog.c
diff options
context:
space:
mode:
authordas <das>2008-12-07 16:48:00 (GMT)
committerdas <das>2008-12-07 16:48:00 (GMT)
commita9e315b665e4e886a8679177d61ed0355c4649ab (patch)
tree88e80343b70169558aef2e8c5783a67316068e11 /macosx/tkMacOSXDialog.c
parentc9cfe0549ecf89a9ac1e0e00edafb230955a0a17 (diff)
downloadtk-a9e315b665e4e886a8679177d61ed0355c4649ab.zip
tk-a9e315b665e4e886a8679177d61ed0355c4649ab.tar.gz
tk-a9e315b665e4e886a8679177d61ed0355c4649ab.tar.bz2
Fix leaks flagged by clang static analyzer
Diffstat (limited to 'macosx/tkMacOSXDialog.c')
-rw-r--r--macosx/tkMacOSXDialog.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 929d3e4..b897162 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.36.2.3 2008/09/02 16:14:18 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.36.2.4 2008/12/07 16:48:00 das Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -323,6 +323,9 @@ Tk_GetOpenFileObjCmd(
break;
case OPEN_MESSAGE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (message) {
+ CFRelease(message);
+ }
message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
choiceLen, kCFStringEncodingUTF8, false);
break;
@@ -341,6 +344,9 @@ Tk_GetOpenFileObjCmd(
break;
case OPEN_TITLE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (title) {
+ CFRelease(title);
+ }
title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
choiceLen, kCFStringEncodingUTF8, false);
break;
@@ -478,6 +484,9 @@ Tk_GetSaveFileObjCmd(
break;
case SAVE_MESSAGE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (message) {
+ CFRelease(message);
+ }
message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
choiceLen, kCFStringEncodingUTF8, false);
break;
@@ -490,6 +499,9 @@ Tk_GetSaveFileObjCmd(
break;
case SAVE_TITLE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (title) {
+ CFRelease(title);
+ }
title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
choiceLen, kCFStringEncodingUTF8, false);
break;
@@ -582,6 +594,9 @@ Tk_ChooseDirectoryObjCmd(
break;
case CHOOSE_MESSAGE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (message) {
+ CFRelease(message);
+ }
message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
choiceLen, kCFStringEncodingUTF8, false);
break;
@@ -594,6 +609,9 @@ Tk_ChooseDirectoryObjCmd(
break;
case CHOOSE_TITLE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (title) {
+ CFRelease(title);
+ }
title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
choiceLen, kCFStringEncodingUTF8, false);
break;
@@ -1483,6 +1501,9 @@ Tk_MessageBoxObjCmd(
case ALERT_DETAIL:
str = Tcl_GetString(objv[i + 1]);
+ if (finemessageTextCF) {
+ CFRelease(finemessageTextCF);
+ }
finemessageTextCF = CFStringCreateWithCString(NULL, str,
kCFStringEncodingUTF8);
break;
@@ -1510,6 +1531,9 @@ Tk_MessageBoxObjCmd(
case ALERT_MESSAGE:
str = Tcl_GetString(objv[i + 1]);
+ if (messageTextCF) {
+ CFRelease(messageTextCF);
+ }
messageTextCF = CFStringCreateWithCString(NULL, str,
kCFStringEncodingUTF8);
break;