From: Gerald J. S. <gs...@us...> - 2007-08-17 22:08:09
|
Update of /cvsroot/xastir/xastir/src In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv32196/src Modified Files: map_cache.c map_geo.c map_tiger.c map_WMS.c Log Message: Make sure to free allocated memory after we are done playing with it. Index: map_cache.c =================================================================== RCS file: /cvsroot/xastir/xastir/src/map_cache.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** map_cache.c 15 Aug 2007 15:44:38 -0000 1.28 --- map_cache.c 17 Aug 2007 22:08:10 -0000 1.29 *************** *** 508,511 **** --- 508,517 ---- set_dangerous("map_cache_get: map_cache_del 1"); map_cache_del(map_cache_url); + if (dbp != NULL) { + if ((mc_t_ret = dbp->close(dbp, 0)) != 0 && mc_ret == 0){ + mc_ret = mc_t_ret; + // db_strerror(mc_ret); + } + } clear_dangerous(); *************** *** 528,531 **** --- 534,543 ---- set_dangerous("map_cache_get: map_cache_del 2"); map_cache_del(map_cache_url); + if (dbp != NULL) { + if ((mc_t_ret = dbp->close(dbp, 0)) != 0 && mc_ret == 0){ + mc_ret = mc_t_ret; + // db_strerror(mc_ret); + } + } clear_dangerous(); return (mc_ret); *************** *** 618,621 **** --- 630,642 ---- // Map not found in cache... statusline(langcode("CACHE003"), 1); + set_dangerous("map_cache_get: dbp->close 3"); + // Only try the close if we have a valid handle + if (dbp != NULL) { + if ((mc_t_ret = dbp->close(dbp, 0)) != 0 && mc_ret == 0){ + mc_ret = mc_t_ret; + // db_strerror(mc_ret); + } + } + clear_dangerous(); return (mc_ret); } Index: map_geo.c =================================================================== RCS file: /cvsroot/xastir/xastir/src/map_geo.c,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** map_geo.c 16 Aug 2007 17:36:34 -0000 1.86 --- map_geo.c 17 Aug 2007 22:08:10 -0000 1.87 *************** *** 623,626 **** --- 623,627 ---- #ifdef USE_MAP_CACHE int map_cache_return; + char *cache_file_id; #endif // USE_MAP_CACHE #endif // HAVE_MAGICK *************** *** 1516,1525 **** } else { xastir_snprintf(local_filename, sizeof(local_filename), "%s/map_%s.%s", get_user_base_dir("map_cache"), ! map_cache_fileid(), ext); } --- 1517,1528 ---- } else { + cache_file_id = map_cache_fileid(); xastir_snprintf(local_filename, sizeof(local_filename), "%s/map_%s.%s", get_user_base_dir("map_cache"), ! cache_file_id, ext); + free(cache_file_id); } Index: map_tiger.c =================================================================== RCS file: /cvsroot/xastir/xastir/src/map_tiger.c,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** map_tiger.c 6 Mar 2007 19:31:14 -0000 1.54 --- map_tiger.c 17 Aug 2007 22:08:10 -0000 1.55 *************** *** 148,151 **** --- 148,152 ---- #ifdef USE_MAP_CACHE int map_cache_return = 1; // Default = cache miss + char *cache_file_id; #endif // USE_MAP_CACHE *************** *** 183,192 **** set_dangerous("map_tiger: map_cache_fileid"); xastir_snprintf(local_filename, MAX_FILENAME, // hardcoded to avoid sizeof() "%s/map_%s.%s", get_user_base_dir("map_cache"), ! map_cache_fileid(), "gif"); clear_dangerous(); --- 184,195 ---- set_dangerous("map_tiger: map_cache_fileid"); + cache_file_id = map_cache_fileid(); xastir_snprintf(local_filename, MAX_FILENAME, // hardcoded to avoid sizeof() "%s/map_%s.%s", get_user_base_dir("map_cache"), ! cache_file_id, "gif"); + free(cache_file_id); clear_dangerous(); Index: map_WMS.c =================================================================== RCS file: /cvsroot/xastir/xastir/src/map_WMS.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** map_WMS.c 20 Jun 2007 15:42:55 -0000 1.27 --- map_WMS.c 17 Aug 2007 22:08:10 -0000 1.28 *************** *** 210,214 **** #ifdef USE_MAP_CACHE ! int map_cache_return; #endif // USE_MAP_CACHE --- 210,215 ---- #ifdef USE_MAP_CACHE ! int map_cache_return; ! char * cache_file_id; #endif // USE_MAP_CACHE *************** *** 522,531 **** } else { xastir_snprintf(local_filename, sizeof(local_filename), "%s/map_%s.%s", get_user_base_dir("map_cache"), ! map_cache_fileid(), "png"); } --- 523,534 ---- } else { + cache_file_id = map_cache_fileid(); xastir_snprintf(local_filename, sizeof(local_filename), "%s/map_%s.%s", get_user_base_dir("map_cache"), ! cache_file_id, "png"); + free(cache_file_id); } |