*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
#ifdef HAVE_CONFIG_H
if (mode == DATA_WRITE) {
int w_err = 0, wrote = 0;
- if ((fp = g_fopen(file, "w+")) == NULL) {
+ if ((fp = g_fopen(file, "wb")) == NULL) {
FILE_OP_ERROR(file, "fopen");
return NULL;
}
tmp_flags |= MSG_DRAFT;
}
- if (msgcache_read_cache_data_str(fp, &srccharset, NULL) < 0)
+ if (msgcache_read_cache_data_str(fp, &srccharset, NULL) < 0) {
+ fclose(fp);
return NULL;
+ }
dstcharset = CS_UTF_8;
if (srccharset == NULL || dstcharset == NULL) {
conv = NULL;
if (!hMapping)
goto w32_fail;
cache_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+ CloseHandle (hMapping);
w32_fail:
;
#else
if (!hMapping)
goto w32_fail2;
cache_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+ CloseHandle (hMapping);
w32_fail2:
;
#else
if (!hMapping)
goto w32_fail6;
cache_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+ CloseHandle (hMapping);
w32_fail6:
;
#else
if (write_fps.cache_fp == NULL) {
g_free(new_cache);
g_free(new_mark);
+ g_free(new_tags);
return -1;
}
if (!hMapping)
goto w32_fail3;
cache_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+ CloseHandle (hMapping);
w32_fail3:
;
#else
if (!hMapping)
goto w32_fail4;
mark_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+ CloseHandle (hMapping);
w32_fail4:
;
#else
if (!hMapping)
goto w32_fail5;
tags_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+ CloseHandle (hMapping);
w32_fail5:
;
#else