diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2017-09-29 20:46:35 +0200 |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2017-09-29 21:11:53 +0200 |
commit | ec30129b41ca705cb1f41df24ad1e886b527385e (patch) | |
tree | ab5dfc150542215983444befd29a51b4981f269a /Source | |
parent | 6bced4bf76e33b5c80a9a821d99ac933afa6ac03 (diff) | |
download | cmake-ec30129b41ca705cb1f41df24ad1e886b527385e.tar.gz |
CPack: put local variable on the stack
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackDragNDropGenerator.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 45c7fc629a..5a173fc124 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -561,8 +561,9 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmCPackLogger(cmCPackLog::LOG_ERROR, languages[i] << " is not a recognized language" << std::endl); } - char* iso_language_cstr = static_cast<char*>(malloc(65)); - CFStringGetCString(iso_language, iso_language_cstr, 64, + char iso_language_cstr[65]; + CFStringGetCString(iso_language, iso_language_cstr, + sizeof(iso_language_cstr) - 1, kCFStringEncodingMacRoman); LangCode lang = 0; RegionCode region = 0; @@ -575,11 +576,9 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmCPackLogger(cmCPackLog::LOG_ERROR, "No language/region code available for " << iso_language_cstr << std::endl); - free(iso_language_cstr); return 0; } #ifdef HAVE_CoreServices - free(iso_language_cstr); header_data.push_back(region); header_data.push_back(i); header_data.push_back(0); |