summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2008-12-07 16:53:21 (GMT)
committerdas <das>2008-12-07 16:53:21 (GMT)
commit1bc1238276cac2e1ca08086ef83b3b607df8a7c7 (patch)
tree24f77b3fc38469af2ac29824a3f93e8610594d76
parent513d914141b92110d2a1e5b36a301fe247611e8e (diff)
downloadtk-1bc1238276cac2e1ca08086ef83b3b607df8a7c7.zip
tk-1bc1238276cac2e1ca08086ef83b3b607df8a7c7.tar.gz
tk-1bc1238276cac2e1ca08086ef83b3b607df8a7c7.tar.bz2
Fix leaks flagged by clang static analyzer
-rw-r--r--macosx/tkMacOSXDialog.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index dd9a448..ac65208 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.4.2.21 2007/11/09 06:26:55 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.4.2.22 2008/12/07 16:53:21 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;
@@ -342,6 +345,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;
@@ -486,6 +492,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;
@@ -499,6 +508,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;
@@ -592,6 +604,9 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
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;
@@ -605,6 +620,9 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
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;
@@ -1479,6 +1497,9 @@ Tk_MessageBoxObjCmd(
#if 0
case ALERT_DETAIL:
str = Tcl_GetString(objv[i + 1]);
+ if (finemessageTextCF) {
+ CFRelease(finemessageTextCF);
+ }
finemessageTextCF = CFStringCreateWithCString(NULL, str,
kCFStringEncodingUTF8);
break;
@@ -1508,6 +1529,9 @@ Tk_MessageBoxObjCmd(
case ALERT_MESSAGE:
str = Tcl_GetString(objv[i + 1]);
+ if (messageTextCF) {
+ CFRelease(messageTextCF);
+ }
messageTextCF = CFStringCreateWithCString(NULL, str,
kCFStringEncodingUTF8);
break;