| 1 |
From 5e25d0add90786446d6083ac46c8f374ae1463cc Mon Sep 17 00:00:00 2001
|
| 2 |
From: pbiava <pierre.biava@nerim.net>
|
| 3 |
Date: Fri, 25 Feb 2011 21:33:51 +0100
|
| 4 |
Subject: [PATCH 4/5] fix memory leaks thanks Philippe D.
|
| 5 |
|
| 6 |
---
|
| 7 |
src/bet_data.c | 199 +++++++++++++++++++++++++++++++-----------
|
| 8 |
src/gsb_assistant_account.c | 1 +
|
| 9 |
src/gsb_file_config.c | 3 +
|
| 10 |
src/gsb_file_load.c | 3 +
|
| 11 |
src/gsb_select_icon.c | 12 ++-
|
| 12 |
src/import.c | 5 +-
|
| 13 |
src/import_csv.c | 3 +
|
| 14 |
src/utils.c | 1 +
|
| 15 |
src/utils_dates.c | 5 +-
|
| 16 |
src/utils_editables.c | 3 +
|
| 17 |
src/utils_files.c | 3 +-
|
| 18 |
src/utils_str.c | 11 ++-
|
| 19 |
12 files changed, 188 insertions(+), 61 deletions(-)
|
| 20 |
|
| 21 |
diff --git a/src/bet_data.c b/src/bet_data.c
|
| 22 |
index 0c9f7e5..fbc25d7 100644
|
| 23 |
--- a/src/bet_data.c
|
| 24 |
+++ b/src/bet_data.c
|
| 25 |
@@ -264,13 +264,19 @@ gboolean bet_data_hist_add_div ( gint account_number,
|
| 26 |
{
|
| 27 |
gchar *key;
|
| 28 |
gchar *sub_key;
|
| 29 |
+ gchar *div_number_str, *account_number_str; // only to avoid memory leaks
|
| 30 |
struct_hist_div *shd;
|
| 31 |
|
| 32 |
+ div_number_str = utils_str_itoa ( div_number );
|
| 33 |
if ( account_number == 0 )
|
| 34 |
- key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
|
| 35 |
+ key = g_strconcat ("0:", div_number_str, NULL );
|
| 36 |
else
|
| 37 |
- key = g_strconcat ( utils_str_itoa ( account_number ), ":",
|
| 38 |
- utils_str_itoa ( div_number ), NULL );
|
| 39 |
+ {
|
| 40 |
+ account_number_str = utils_str_itoa ( account_number );
|
| 41 |
+ key = g_strconcat ( account_number_str, ":", div_number_str, NULL );
|
| 42 |
+ g_free ( account_number_str );
|
| 43 |
+ }
|
| 44 |
+ g_free ( div_number_str );
|
| 45 |
|
| 46 |
if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
|
| 47 |
{
|
| 48 |
@@ -342,13 +348,19 @@ void bet_data_insert_div_hist ( struct_hist_div *shd, struct_hist_div *sub_shd )
|
| 49 |
{
|
| 50 |
gchar *key;
|
| 51 |
gchar *sub_key;
|
| 52 |
+ gchar *div_number_str, *account_nb_str; // only to avoid memory leaks
|
| 53 |
struct_hist_div *tmp_shd;
|
| 54 |
|
| 55 |
+ div_number_str = utils_str_itoa ( shd -> div_number );
|
| 56 |
if ( shd -> account_nb == 0 )
|
| 57 |
- key = g_strconcat ("0:", utils_str_itoa ( shd -> div_number ), NULL );
|
| 58 |
+ key = g_strconcat ("0:", div_number_str, NULL );
|
| 59 |
else
|
| 60 |
- key = g_strconcat ( utils_str_itoa ( shd -> account_nb ), ":",
|
| 61 |
- utils_str_itoa ( shd -> div_number ), NULL );
|
| 62 |
+ {
|
| 63 |
+ account_nb_str = utils_str_itoa ( shd -> account_nb );
|
| 64 |
+ key = g_strconcat ( account_nb_str, ":", div_number_str, NULL );
|
| 65 |
+ g_free ( account_nb_str );
|
| 66 |
+ }
|
| 67 |
+ g_free ( div_number_str );
|
| 68 |
|
| 69 |
if ( ( tmp_shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
|
| 70 |
{
|
| 71 |
@@ -383,13 +395,19 @@ gboolean bet_data_remove_div_hist ( gint account_number, gint div_number, gint s
|
| 72 |
{
|
| 73 |
gchar *key;
|
| 74 |
char *sub_key;
|
| 75 |
+ gchar *div_number_str, *account_number_str; // only to avoid memory leaks
|
| 76 |
struct_hist_div *shd;
|
| 77 |
|
| 78 |
+ div_number_str = utils_str_itoa ( div_number );
|
| 79 |
if ( account_number == 0 )
|
| 80 |
- key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
|
| 81 |
+ key = g_strconcat ("0:", div_number_str, NULL );
|
| 82 |
else
|
| 83 |
- key = g_strconcat ( utils_str_itoa ( account_number ), ":",
|
| 84 |
- utils_str_itoa ( div_number ), NULL );
|
| 85 |
+ {
|
| 86 |
+ account_number_str = utils_str_itoa ( account_number );
|
| 87 |
+ key = g_strconcat ( account_number_str, ":", div_number_str, NULL );
|
| 88 |
+ g_free ( account_number_str );
|
| 89 |
+ }
|
| 90 |
+ g_free ( div_number_str );
|
| 91 |
|
| 92 |
if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
|
| 93 |
{
|
| 94 |
@@ -418,14 +436,20 @@ gboolean bet_data_search_div_hist ( gint account_number, gint div_number, gint s
|
| 95 |
{
|
| 96 |
gchar *key;
|
| 97 |
gchar *sub_key;
|
| 98 |
+ gchar *div_number_str, *account_number_str; // only to avoid memory leaks
|
| 99 |
gint origin;
|
| 100 |
struct_hist_div *shd;
|
| 101 |
|
| 102 |
+ div_number_str = utils_str_itoa ( div_number );
|
| 103 |
if ( account_number == 0 )
|
| 104 |
- key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
|
| 105 |
+ key = g_strconcat ("0:", div_number_str, NULL );
|
| 106 |
else
|
| 107 |
- key = g_strconcat ( utils_str_itoa ( account_number ), ":",
|
| 108 |
- utils_str_itoa ( div_number ), NULL );
|
| 109 |
+ {
|
| 110 |
+ account_number_str = utils_str_itoa ( account_number );
|
| 111 |
+ key = g_strconcat ( account_number_str, ":", div_number_str, NULL );
|
| 112 |
+ g_free ( account_number_str );
|
| 113 |
+ }
|
| 114 |
+ g_free ( div_number_str );
|
| 115 |
|
| 116 |
origin = gsb_data_account_get_bet_hist_data ( account_number );
|
| 117 |
|
| 118 |
@@ -539,15 +563,21 @@ gchar *bet_data_get_div_name ( gint div_num,
|
| 119 |
gboolean bet_data_get_div_edited ( gint account_number, gint div_number, gint sub_div_nb )
|
| 120 |
{
|
| 121 |
gchar *key;
|
| 122 |
+ gchar *div_number_str, *account_number_str; // only to avoid memory leaks
|
| 123 |
gint origin;
|
| 124 |
struct_hist_div *shd;
|
| 125 |
gboolean edited;
|
| 126 |
|
| 127 |
+ div_number_str = utils_str_itoa ( div_number );
|
| 128 |
if ( account_number == 0 )
|
| 129 |
- key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
|
| 130 |
+ key = g_strconcat ("0:", div_number_str, NULL );
|
| 131 |
else
|
| 132 |
- key = g_strconcat ( utils_str_itoa ( account_number ), ":",
|
| 133 |
- utils_str_itoa ( div_number ), NULL );
|
| 134 |
+ {
|
| 135 |
+ account_number_str = utils_str_itoa ( account_number );
|
| 136 |
+ key = g_strconcat ( account_number_str, ":", div_number_str, NULL );
|
| 137 |
+ g_free ( account_number_str );
|
| 138 |
+ }
|
| 139 |
+ g_free ( div_number_str );
|
| 140 |
|
| 141 |
origin = gsb_data_account_get_bet_hist_data ( account_number );
|
| 142 |
|
| 143 |
@@ -589,13 +619,19 @@ gboolean bet_data_set_div_edited ( gint account_nb,
|
| 144 |
gboolean edited )
|
| 145 |
{
|
| 146 |
gchar *key;
|
| 147 |
+ gchar *div_number_str, *account_nb_str; // only to avoid memory leaks
|
| 148 |
struct_hist_div *shd;
|
| 149 |
|
| 150 |
+ div_number_str = utils_str_itoa ( div_number );
|
| 151 |
if ( account_nb == 0 )
|
| 152 |
- key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
|
| 153 |
+ key = g_strconcat ("0:", div_number_str, NULL );
|
| 154 |
else
|
| 155 |
- key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
|
| 156 |
- utils_str_itoa ( div_number ), NULL );
|
| 157 |
+ {
|
| 158 |
+ account_nb_str = utils_str_itoa ( account_nb );
|
| 159 |
+ key = g_strconcat ( account_nb_str, ":", div_number_str, NULL );
|
| 160 |
+ g_free ( account_nb_str );
|
| 161 |
+ }
|
| 162 |
+ g_free ( div_number_str );
|
| 163 |
|
| 164 |
if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
|
| 165 |
{
|
| 166 |
@@ -628,14 +664,20 @@ gboolean bet_data_set_div_edited ( gint account_nb,
|
| 167 |
gsb_real bet_data_hist_get_div_amount ( gint account_nb, gint div_number, gint sub_div_nb )
|
| 168 |
{
|
| 169 |
gchar *key;
|
| 170 |
+ gchar *div_number_str, *account_nb_str; // only to avoid memory leaks
|
| 171 |
struct_hist_div *shd;
|
| 172 |
gsb_real amount;
|
| 173 |
|
| 174 |
+ div_number_str = utils_str_itoa ( div_number );
|
| 175 |
if ( account_nb == 0 )
|
| 176 |
- key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
|
| 177 |
+ key = g_strconcat ("0:", div_number_str, NULL );
|
| 178 |
else
|
| 179 |
- key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
|
| 180 |
- utils_str_itoa ( div_number ), NULL );
|
| 181 |
+ {
|
| 182 |
+ account_nb_str = utils_str_itoa ( account_nb );
|
| 183 |
+ key = g_strconcat ( account_nb_str, ":", div_number_str, NULL );
|
| 184 |
+ g_free ( account_nb_str );
|
| 185 |
+ }
|
| 186 |
+ g_free ( div_number_str );
|
| 187 |
|
| 188 |
if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
|
| 189 |
{
|
| 190 |
@@ -674,13 +716,19 @@ gboolean bet_data_set_div_amount ( gint account_nb,
|
| 191 |
gsb_real amount )
|
| 192 |
{
|
| 193 |
gchar *key;
|
| 194 |
+ gchar *div_number_str, *account_nb_str; // only to avoid memory leaks
|
| 195 |
struct_hist_div *shd;
|
| 196 |
|
| 197 |
+ div_number_str = utils_str_itoa ( div_number );
|
| 198 |
if ( account_nb == 0 )
|
| 199 |
- key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
|
| 200 |
+ key = g_strconcat ("0:", div_number_str, NULL );
|
| 201 |
else
|
| 202 |
- key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
|
| 203 |
- utils_str_itoa ( div_number ), NULL );
|
| 204 |
+ {
|
| 205 |
+ account_nb_str = utils_str_itoa ( account_nb );
|
| 206 |
+ key = g_strconcat ( account_nb_str, ":", div_number_str, NULL );
|
| 207 |
+ g_free ( account_nb_str );
|
| 208 |
+ }
|
| 209 |
+ g_free ( div_number_str );
|
| 210 |
|
| 211 |
if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
|
| 212 |
{
|
| 213 |
@@ -1167,16 +1215,22 @@ void struct_free_bet_future ( struct_futur_data *scheduled )
|
| 214 |
gboolean bet_data_future_add_lines ( struct_futur_data *scheduled )
|
| 215 |
{
|
| 216 |
gchar *key;
|
| 217 |
+ gchar *future_number_str, *account_nb_str; // only to avoid memory leaks
|
| 218 |
|
| 219 |
future_number ++;
|
| 220 |
|
| 221 |
if ( scheduled -> frequency == 0 )
|
| 222 |
{
|
| 223 |
+ future_number_str = utils_str_itoa ( future_number );
|
| 224 |
if ( scheduled -> account_number == 0 )
|
| 225 |
- key = g_strconcat ("0:", utils_str_itoa ( future_number ), NULL );
|
| 226 |
+ key = g_strconcat ("0:", future_number_str, NULL );
|
| 227 |
else
|
| 228 |
- key = g_strconcat ( utils_str_itoa ( scheduled -> account_number ), ":",
|
| 229 |
- utils_str_itoa ( future_number ), NULL );
|
| 230 |
+ {
|
| 231 |
+ account_nb_str = utils_str_itoa ( scheduled -> account_number );
|
| 232 |
+ key = g_strconcat ( account_nb_str, ":", future_number_str, NULL );
|
| 233 |
+ g_free ( account_nb_str );
|
| 234 |
+ }
|
| 235 |
+ g_free ( future_number_str );
|
| 236 |
|
| 237 |
scheduled -> number = future_number;
|
| 238 |
g_hash_table_insert ( bet_future_list, key, scheduled );
|
| 239 |
@@ -1196,11 +1250,16 @@ gboolean bet_data_future_add_lines ( struct_futur_data *scheduled )
|
| 240 |
date = gsb_date_copy ( scheduled -> date );
|
| 241 |
while ( date != NULL && g_date_valid ( date ) )
|
| 242 |
{
|
| 243 |
+ future_number_str = utils_str_itoa ( future_number );
|
| 244 |
if ( scheduled -> account_number == 0 )
|
| 245 |
key = g_strconcat ("0:", utils_str_itoa ( future_number ), NULL );
|
| 246 |
else
|
| 247 |
- key = g_strconcat ( utils_str_itoa ( scheduled -> account_number ), ":",
|
| 248 |
- utils_str_itoa ( future_number ), NULL );
|
| 249 |
+ {
|
| 250 |
+ account_nb_str = utils_str_itoa ( scheduled -> account_number );
|
| 251 |
+ key = g_strconcat ( account_nb_str, ":", future_number_str, NULL );
|
| 252 |
+ g_free ( account_nb_str );
|
| 253 |
+ }
|
| 254 |
+ g_free ( future_number_str );
|
| 255 |
|
| 256 |
if ( mother_row == future_number )
|
| 257 |
new_sch = scheduled;
|
| 258 |
@@ -1236,16 +1295,22 @@ gboolean bet_data_future_add_lines ( struct_futur_data *scheduled )
|
| 259 |
gboolean bet_data_future_set_lines_from_file ( struct_futur_data *scheduled )
|
| 260 |
{
|
| 261 |
gchar *key;
|
| 262 |
+ gchar *number_str, *account_nb_str; // only to avoid memory leaks
|
| 263 |
|
| 264 |
- if ( scheduled -> account_number == 0 )
|
| 265 |
- key = g_strconcat ("0:", utils_str_itoa ( scheduled -> number ), NULL );
|
| 266 |
- else
|
| 267 |
- key = g_strconcat ( utils_str_itoa ( scheduled -> account_number ), ":",
|
| 268 |
- utils_str_itoa ( scheduled -> number ), NULL );
|
| 269 |
+ number_str = utils_str_itoa ( scheduled -> number );
|
| 270 |
+ if ( scheduled -> account_number == 0 )
|
| 271 |
+ key = g_strconcat ("0:", number_str, NULL );
|
| 272 |
+ else
|
| 273 |
+ {
|
| 274 |
+ account_nb_str = utils_str_itoa ( scheduled -> account_number );
|
| 275 |
+ key = g_strconcat ( account_nb_str, ":", number_str, NULL );
|
| 276 |
+ g_free ( account_nb_str );
|
| 277 |
+ }
|
| 278 |
+ g_free ( number_str );
|
| 279 |
|
| 280 |
- bet_data_future_set_max_number ( scheduled -> number );
|
| 281 |
+ bet_data_future_set_max_number ( scheduled -> number );
|
| 282 |
|
| 283 |
- g_hash_table_insert ( bet_future_list, key, scheduled );
|
| 284 |
+ g_hash_table_insert ( bet_future_list, key, scheduled );
|
| 285 |
|
| 286 |
return TRUE;
|
| 287 |
}
|
| 288 |
@@ -1557,12 +1622,18 @@ GDate *bet_data_array_get_date_max ( gint account_number )
|
| 289 |
gboolean bet_data_future_modify_lines ( struct_futur_data *scheduled )
|
| 290 |
{
|
| 291 |
gchar *key;
|
| 292 |
+ gchar *number_str, *account_nb_str; // only to avoid memory leaks
|
| 293 |
|
| 294 |
+ number_str = utils_str_itoa ( scheduled -> number );
|
| 295 |
if ( scheduled -> account_number == 0 )
|
| 296 |
- key = g_strconcat ("0:", utils_str_itoa ( scheduled -> number ), NULL );
|
| 297 |
+ key = g_strconcat ("0:", number_str, NULL );
|
| 298 |
else
|
| 299 |
- key = g_strconcat ( utils_str_itoa ( scheduled -> account_number ), ":",
|
| 300 |
- utils_str_itoa ( scheduled -> number ), NULL );
|
| 301 |
+ {
|
| 302 |
+ account_nb_str = utils_str_itoa ( scheduled -> account_number );
|
| 303 |
+ key = g_strconcat ( account_nb_str, ":", number_str, NULL );
|
| 304 |
+ g_free ( account_nb_str );
|
| 305 |
+ }
|
| 306 |
+ g_free ( number_str );
|
| 307 |
|
| 308 |
g_hash_table_replace ( bet_future_list, key, scheduled );
|
| 309 |
|
| 310 |
@@ -1582,13 +1653,19 @@ gboolean bet_data_future_modify_lines ( struct_futur_data *scheduled )
|
| 311 |
struct_futur_data *bet_data_future_get_struct ( gint account_number, gint number )
|
| 312 |
{
|
| 313 |
gchar *key;
|
| 314 |
+ gchar *number_str, *account_nb_str; // only to avoid memory leaks
|
| 315 |
struct_futur_data *scheduled;
|
| 316 |
|
| 317 |
- if ( account_number == 0 )
|
| 318 |
- key = g_strconcat ("0:", utils_str_itoa ( number ), NULL );
|
| 319 |
+ number_str = utils_str_itoa ( number );
|
| 320 |
+ if ( scheduled -> account_number == 0 )
|
| 321 |
+ key = g_strconcat ("0:", number_str, NULL );
|
| 322 |
else
|
| 323 |
- key = g_strconcat ( utils_str_itoa ( account_number ), ":",
|
| 324 |
- utils_str_itoa ( number ), NULL );
|
| 325 |
+ {
|
| 326 |
+ account_nb_str = utils_str_itoa ( account_number );
|
| 327 |
+ key = g_strconcat ( account_nb_str, ":", number_str, NULL );
|
| 328 |
+ g_free ( account_nb_str );
|
| 329 |
+ }
|
| 330 |
+ g_free ( number_str );
|
| 331 |
|
| 332 |
if ( ( scheduled = g_hash_table_lookup ( bet_future_list, key ) ) )
|
| 333 |
return scheduled;
|
| 334 |
@@ -1651,14 +1728,20 @@ GHashTable *bet_data_transfert_get_list ( void )
|
| 335 |
gboolean bet_data_transfert_add_line ( struct_transfert_data *transfert )
|
| 336 |
{
|
| 337 |
gchar *key;
|
| 338 |
+ gchar *transfert_nb_str, *account_nb_str; // only to avoid memory leaks
|
| 339 |
|
| 340 |
transfert_number ++;
|
| 341 |
|
| 342 |
+ transfert_nb_str = utils_str_itoa ( transfert_number );
|
| 343 |
if ( transfert -> account_number == 0 )
|
| 344 |
- key = g_strconcat ("0:", utils_str_itoa ( transfert_number ), NULL );
|
| 345 |
+ key = g_strconcat ("0:", transfert_nb_str, NULL );
|
| 346 |
else
|
| 347 |
- key = g_strconcat ( utils_str_itoa ( transfert -> account_number ), ":",
|
| 348 |
- utils_str_itoa ( transfert_number ), NULL );
|
| 349 |
+ {
|
| 350 |
+ account_nb_str = utils_str_itoa ( transfert -> account_number );
|
| 351 |
+ key = g_strconcat ( account_nb_str, ":", transfert_nb_str, NULL );
|
| 352 |
+ g_free ( account_nb_str );
|
| 353 |
+ }
|
| 354 |
+ g_free ( transfert_nb_str );
|
| 355 |
|
| 356 |
transfert -> number = transfert_number;
|
| 357 |
g_hash_table_insert ( bet_transfert_list, key, transfert );
|
| 358 |
@@ -1715,12 +1798,18 @@ gboolean bet_data_transfert_remove_line ( gint account_number, gint number )
|
| 359 |
gboolean bet_data_transfert_set_line_from_file ( struct_transfert_data *transfert )
|
| 360 |
{
|
| 361 |
gchar *key;
|
| 362 |
+ gchar *transfert_nb_str, *account_nb_str; // only to avoid memory leaks
|
| 363 |
|
| 364 |
+ transfert_nb_str = utils_str_itoa ( transfert -> number );
|
| 365 |
if ( transfert -> account_number == 0 )
|
| 366 |
- key = g_strconcat ("0:", utils_str_itoa ( transfert -> number ), NULL );
|
| 367 |
+ key = g_strconcat ("0:", transfert_nb_str, NULL );
|
| 368 |
else
|
| 369 |
- key = g_strconcat ( utils_str_itoa ( transfert -> account_number ), ":",
|
| 370 |
- utils_str_itoa ( transfert -> number ), NULL );
|
| 371 |
+ {
|
| 372 |
+ account_nb_str = utils_str_itoa ( transfert -> account_number );
|
| 373 |
+ key = g_strconcat ( account_nb_str, ":", transfert_nb_str, NULL );
|
| 374 |
+ g_free ( account_nb_str );
|
| 375 |
+ }
|
| 376 |
+ g_free ( transfert_nb_str );
|
| 377 |
|
| 378 |
if ( transfert -> number > transfert_number )
|
| 379 |
transfert_number = transfert -> number;
|
| 380 |
@@ -1740,12 +1829,18 @@ gboolean bet_data_transfert_set_line_from_file ( struct_transfert_data *transfer
|
| 381 |
gboolean bet_data_transfert_modify_line ( struct_transfert_data *transfert )
|
| 382 |
{
|
| 383 |
gchar *key;
|
| 384 |
+ gchar *transfert_nb_str, *account_nb_str; // only to avoid memory leaks
|
| 385 |
|
| 386 |
+ transfert_nb_str = utils_str_itoa ( transfert -> number );
|
| 387 |
if ( transfert -> account_number == 0 )
|
| 388 |
- key = g_strconcat ("0:", utils_str_itoa ( transfert -> number ), NULL );
|
| 389 |
+ key = g_strconcat ("0:", transfert_nb_str, NULL );
|
| 390 |
else
|
| 391 |
- key = g_strconcat ( utils_str_itoa ( transfert -> account_number ), ":",
|
| 392 |
- utils_str_itoa ( transfert -> number ), NULL );
|
| 393 |
+ {
|
| 394 |
+ account_nb_str = utils_str_itoa ( transfert -> account_number );
|
| 395 |
+ key = g_strconcat ( account_nb_str, ":", transfert_nb_str, NULL );
|
| 396 |
+ g_free ( account_nb_str );
|
| 397 |
+ }
|
| 398 |
+ g_free ( transfert_nb_str );
|
| 399 |
|
| 400 |
g_hash_table_replace ( bet_transfert_list, key, transfert );
|
| 401 |
|
| 402 |
diff --git a/src/gsb_assistant_account.c b/src/gsb_assistant_account.c
|
| 403 |
index 84f1caf..83eb348 100644
|
| 404 |
--- a/src/gsb_assistant_account.c
|
| 405 |
+++ b/src/gsb_assistant_account.c
|
| 406 |
@@ -498,6 +498,7 @@ void gsb_assistant_account_change_account_icon ( GtkWidget *button, gpointer dat
|
| 407 |
{
|
| 408 |
devel_debug ( error -> message );
|
| 409 |
dialogue_error ( error -> message );
|
| 410 |
+ g_error_free ( error );
|
| 411 |
}
|
| 412 |
else
|
| 413 |
{
|
| 414 |
diff --git a/src/gsb_file_config.c b/src/gsb_file_config.c
|
| 415 |
index 851552c..6dcfb94 100644
|
| 416 |
--- a/src/gsb_file_config.c
|
| 417 |
+++ b/src/gsb_file_config.c
|
| 418 |
@@ -1540,7 +1540,10 @@ gchar *gsb_config_get_old_conf_name ( void )
|
| 419 |
}
|
| 420 |
}
|
| 421 |
else
|
| 422 |
+ {
|
| 423 |
dialogue_error ( error -> message );
|
| 424 |
+ g_error_free ( error );
|
| 425 |
+ }
|
| 426 |
|
| 427 |
if ( g_slist_length ( liste ) == 0 )
|
| 428 |
return NULL;
|
| 429 |
diff --git a/src/gsb_file_load.c b/src/gsb_file_load.c
|
| 430 |
index f5be275..4c78fb8 100644
|
| 431 |
--- a/src/gsb_file_load.c
|
| 432 |
+++ b/src/gsb_file_load.c
|
| 433 |
@@ -9027,7 +9027,10 @@ void gsb_file_load_copy_old_file ( gchar *filename, gchar *file_content)
|
| 434 |
file_copy = g_file_new_for_path ( copy_old_filename );
|
| 435 |
if ( !g_file_copy ( file_ori, file_copy, G_FILE_COPY_OVERWRITE,
|
| 436 |
NULL, NULL, NULL, &error ) )
|
| 437 |
+ {
|
| 438 |
dialogue_error (error -> message );
|
| 439 |
+ g_error_free ( error );
|
| 440 |
+ }
|
| 441 |
}
|
| 442 |
}
|
| 443 |
/* Local Variables: */
|
| 444 |
diff --git a/src/gsb_select_icon.c b/src/gsb_select_icon.c
|
| 445 |
index bbbf6d9..7a75142 100644
|
| 446 |
--- a/src/gsb_select_icon.c
|
| 447 |
+++ b/src/gsb_select_icon.c
|
| 448 |
@@ -369,7 +369,10 @@ GtkTreePath * gsb_select_icon_fill_icon_view ( gchar * name_icon )
|
| 449 |
g_dir_close ( dir );
|
| 450 |
}
|
| 451 |
else
|
| 452 |
+ {
|
| 453 |
dialogue_error ( error -> message );
|
| 454 |
+ g_error_free ( error );
|
| 455 |
+ }
|
| 456 |
|
| 457 |
if ( tree_path == NULL )
|
| 458 |
tree_path = gtk_tree_path_new_from_string ( "0" );
|
| 459 |
@@ -657,7 +660,10 @@ GdkPixbuf *gsb_select_icon_get_default_logo_pixbuf ( void )
|
| 460 |
(GRISBI_PIXMAPS_DIR, "grisbi-logo.png", NULL), &error );
|
| 461 |
|
| 462 |
if ( ! pixbuf )
|
| 463 |
+ {
|
| 464 |
devel_debug ( error -> message );
|
| 465 |
+ g_error_free ( error );
|
| 466 |
+ }
|
| 467 |
|
| 468 |
if ( gdk_pixbuf_get_width (pixbuf) > LOGO_WIDTH ||
|
| 469 |
gdk_pixbuf_get_height (pixbuf) > LOGO_HEIGHT )
|
| 470 |
@@ -890,6 +896,7 @@ gboolean gsb_select_icon_new_account_icon_from_file ( gint account_number,
|
| 471 |
filename, NULL );
|
| 472 |
devel_debug ( tmp_str );
|
| 473 |
dialogue_error ( tmp_str );
|
| 474 |
+ g_error_free ( error );
|
| 475 |
g_free ( tmp_str );
|
| 476 |
g_free ( icon );
|
| 477 |
|
| 478 |
@@ -909,13 +916,12 @@ GdkPixbuf *gsb_select_icon_change_account_pixbuf ( gint account_number,
|
| 479 |
{
|
| 480 |
GSList *list_tmp;
|
| 481 |
GdkPixbuf *pixbuf;
|
| 482 |
- GError *error = NULL;
|
| 483 |
|
| 484 |
if ( icon_buffer
|
| 485 |
&&
|
| 486 |
icon_buffer -> account_number == account_number )
|
| 487 |
{
|
| 488 |
- pixbuf = gdk_pixbuf_new_from_file_at_size ( filename , 32, 32, &error );
|
| 489 |
+ pixbuf = gdk_pixbuf_new_from_file_at_size ( filename , 32, 32, NULL );
|
| 490 |
if ( pixbuf )
|
| 491 |
{
|
| 492 |
g_object_unref ( icon_buffer -> pixbuf );
|
| 493 |
@@ -937,7 +943,7 @@ GdkPixbuf *gsb_select_icon_change_account_pixbuf ( gint account_number,
|
| 494 |
|
| 495 |
if ( icon -> account_number == account_number )
|
| 496 |
{
|
| 497 |
- pixbuf = gdk_pixbuf_new_from_file_at_size ( filename , 32, 32, &error );
|
| 498 |
+ pixbuf = gdk_pixbuf_new_from_file_at_size ( filename , 32, 32, NULL );
|
| 499 |
if ( pixbuf )
|
| 500 |
{
|
| 501 |
g_object_unref ( icon -> pixbuf );
|
| 502 |
diff --git a/src/import.c b/src/import.c
|
| 503 |
index 1d5ceeb..5543aa1 100644
|
| 504 |
--- a/src/import.c
|
| 505 |
+++ b/src/import.c
|
| 506 |
@@ -534,6 +534,7 @@ gboolean import_switch_type ( GtkCellRendererText *cell, const gchar *path,
|
| 507 |
if ( ! g_file_get_contents ( nom_fichier, &tmp_str, NULL, &error ) )
|
| 508 |
{
|
| 509 |
g_print ( _("Unable to read file: %s\n"), error -> message);
|
| 510 |
+ g_error_free ( error );
|
| 511 |
return FALSE;
|
| 512 |
}
|
| 513 |
|
| 514 |
@@ -688,6 +689,7 @@ gboolean import_select_file ( GtkWidget * button, GtkWidget * assistant )
|
| 515 |
if ( ! g_file_get_contents ( iterator -> data, &tmp_str, NULL, &error ) )
|
| 516 |
{
|
| 517 |
g_print ( _("Unable to read file: %s\n"), error -> message);
|
| 518 |
+ g_error_free ( error );
|
| 519 |
return FALSE;
|
| 520 |
}
|
| 521 |
|
| 522 |
@@ -4386,6 +4388,7 @@ gboolean gsb_import_by_rule ( gint rule )
|
| 523 |
if ( ! g_file_get_contents ( filename, &pointeur_char, NULL, &error ) )
|
| 524 |
{
|
| 525 |
g_print ( _("Unable to read file: %s\n"), error -> message);
|
| 526 |
+ g_error_free ( error );
|
| 527 |
i++;
|
| 528 |
continue;
|
| 529 |
}
|
| 530 |
@@ -4677,6 +4680,7 @@ gboolean gsb_import_set_tmp_file ( gchar *filename,
|
| 531 |
{
|
| 532 |
g_free (contenu_fichier);
|
| 533 |
g_print ( _("Unable to create tmp file: %s\n"), error -> message);
|
| 534 |
+ g_error_free ( error );
|
| 535 |
return FALSE;
|
| 536 |
}
|
| 537 |
|
| 538 |
@@ -4710,7 +4714,6 @@ gboolean gsb_import_gunzip_file ( gchar *filename )
|
| 539 |
dialogue_error ( tmpstr );
|
| 540 |
g_free ( file_content);
|
| 541 |
g_error_free (error);
|
| 542 |
-
|
| 543 |
return FALSE;
|
| 544 |
}
|
| 545 |
else
|
| 546 |
diff --git a/src/import_csv.c b/src/import_csv.c
|
| 547 |
index 88b1462..4b1707f 100644
|
| 548 |
--- a/src/import_csv.c
|
| 549 |
+++ b/src/import_csv.c
|
| 550 |
@@ -1081,6 +1081,7 @@ gboolean import_enter_csv_preview_page ( GtkWidget * assistant )
|
| 551 |
if ( ! g_file_get_contents ( filename, &tmp_str, &size, &error ) )
|
| 552 |
{
|
| 553 |
g_print ( _("Unable to read file: %s\n"), error -> message);
|
| 554 |
+ g_error_free ( error );
|
| 555 |
return FALSE;
|
| 556 |
}
|
| 557 |
|
| 558 |
@@ -1091,6 +1092,7 @@ gboolean import_enter_csv_preview_page ( GtkWidget * assistant )
|
| 559 |
|
| 560 |
if ( contents == NULL )
|
| 561 |
{
|
| 562 |
+ g_error_free ( error );
|
| 563 |
error = NULL;
|
| 564 |
size = 0;
|
| 565 |
bytes_written = 0;
|
| 566 |
@@ -1105,6 +1107,7 @@ gboolean import_enter_csv_preview_page ( GtkWidget * assistant )
|
| 567 |
if ( bytes_written == 0 )
|
| 568 |
{
|
| 569 |
g_print ( _("Unable to read file: %s\n"), error -> message);
|
| 570 |
+ g_error_free ( error );
|
| 571 |
return FALSE;
|
| 572 |
}
|
| 573 |
}
|
| 574 |
diff --git a/src/utils.c b/src/utils.c
|
| 575 |
index 16361ef..aeb64ef 100644
|
| 576 |
--- a/src/utils.c
|
| 577 |
+++ b/src/utils.c
|
| 578 |
@@ -555,6 +555,7 @@ void lance_mailer ( const gchar *uri )
|
| 579 |
tmp_str = g_strdup_printf ( _("Grisbi was unable to execute a mailer to write at <tt>%s</tt>.\n"
|
| 580 |
"The error was: %s."),
|
| 581 |
uri, error -> message );
|
| 582 |
+ g_error_free ( error );
|
| 583 |
dialogue_error_hint ( tmp_str, _("Cannot execute mailer") );
|
| 584 |
g_free(tmp_str);
|
| 585 |
}
|
| 586 |
diff --git a/src/utils_dates.c b/src/utils_dates.c
|
| 587 |
index 4f45bb2..c84118e 100644
|
| 588 |
--- a/src/utils_dates.c
|
| 589 |
+++ b/src/utils_dates.c
|
| 590 |
@@ -79,6 +79,7 @@ gchar *gsb_date_today ( void )
|
| 591 |
date = gdate_today ( );
|
| 592 |
date_string = gsb_format_gdate ( date );
|
| 593 |
gsb_date_set_last_date ( date_string );
|
| 594 |
+ g_free ( date_string );
|
| 595 |
g_date_free ( date );
|
| 596 |
}
|
| 597 |
return (last_date);
|
| 598 |
@@ -678,8 +679,10 @@ gchar *gsb_date_get_compiled_time ( void )
|
| 599 |
|
| 600 |
date = g_date_new_dmy ( atoi ( tab[1] ), mois, atoi ( tab[2] ) );
|
| 601 |
g_strfreev (tab);
|
| 602 |
+ str = gsb_format_gdate ( date );
|
| 603 |
+ g_date_free ( date );
|
| 604 |
|
| 605 |
- return gsb_format_gdate ( date );
|
| 606 |
+ return str;
|
| 607 |
}
|
| 608 |
|
| 609 |
|
| 610 |
diff --git a/src/utils_editables.c b/src/utils_editables.c
|
| 611 |
index ecfd082..6b15472 100644
|
| 612 |
--- a/src/utils_editables.c
|
| 613 |
+++ b/src/utils_editables.c
|
| 614 |
@@ -155,7 +155,10 @@ gsb_real gsb_utils_edit_calculate_entry ( GtkWidget *entry )
|
| 615 |
if ( string && strlen ( string ) )
|
| 616 |
pointeur = string + strlen ( string );
|
| 617 |
else
|
| 618 |
+ {
|
| 619 |
+ g_free ( string );
|
| 620 |
return total;
|
| 621 |
+ }
|
| 622 |
|
| 623 |
if ( g_utf8_strchr ( string, -1, '-' ) || g_utf8_strchr ( string, -1, '+' ) )
|
| 624 |
{
|
| 625 |
diff --git a/src/utils_files.c b/src/utils_files.c
|
| 626 |
index d86629a..032db50 100644
|
| 627 |
--- a/src/utils_files.c
|
| 628 |
+++ b/src/utils_files.c
|
| 629 |
@@ -534,7 +534,6 @@ GSList *utils_files_check_UTF8_validity ( const gchar *contents,
|
| 630 |
gint long_str = 0;
|
| 631 |
gsize size = 0;
|
| 632 |
gsize bytes_written = 0;
|
| 633 |
- GError * error = NULL;
|
| 634 |
gint i = 0;
|
| 635 |
gchar *ptr;
|
| 636 |
|
| 637 |
@@ -565,7 +564,7 @@ GSList *utils_files_check_UTF8_validity ( const gchar *contents,
|
| 638 |
do
|
| 639 |
{
|
| 640 |
tmp_str = g_convert ( string, long_str, "UTF-8", charset_array[i],
|
| 641 |
- &size, &bytes_written, &error );
|
| 642 |
+ &size, &bytes_written, NULL );
|
| 643 |
if ( tmp_str )
|
| 644 |
{
|
| 645 |
result = g_malloc0 ( sizeof ( struct struc_check_encoding ) );
|
| 646 |
diff --git a/src/utils_str.c b/src/utils_str.c
|
| 647 |
index 8c1e881..729a8a8 100644
|
| 648 |
--- a/src/utils_str.c
|
| 649 |
+++ b/src/utils_str.c
|
| 650 |
@@ -892,12 +892,16 @@ gchar *utils_str_dtostr ( gdouble number, gint nbre_decimal, gboolean canonical
|
| 651 |
{
|
| 652 |
gchar buffer[G_ASCII_DTOSTR_BUF_SIZE];
|
| 653 |
gchar *str_number;
|
| 654 |
+ gchar *decimal;
|
| 655 |
gchar *format;
|
| 656 |
gint nbre_char;
|
| 657 |
|
| 658 |
- format = g_strconcat ( "%.", utils_str_itoa ( nbre_decimal ), "f", NULL );
|
| 659 |
-
|
| 660 |
+ decimal = utils_str_itoa ( nbre_decimal );
|
| 661 |
+ format = g_strconcat ( "%.", decimal, "f", NULL );
|
| 662 |
nbre_char = g_sprintf ( buffer, format, number );
|
| 663 |
+ g_free ( decimal );
|
| 664 |
+ g_free ( format );
|
| 665 |
+
|
| 666 |
if ( nbre_char > G_ASCII_DTOSTR_BUF_SIZE )
|
| 667 |
return NULL;
|
| 668 |
|
| 669 |
@@ -1004,7 +1008,10 @@ gchar *utils_str_incremente_number_from_str ( const gchar *str_number, gint incr
|
| 670 |
new_str_number = utils_str_itoa ( number );
|
| 671 |
|
| 672 |
if ( prefix && strlen ( prefix ) > 0 )
|
| 673 |
+ {
|
| 674 |
new_str_number = g_strconcat ( prefix, new_str_number, NULL );
|
| 675 |
+ g_free ( prefix );
|
| 676 |
+ }
|
| 677 |
|
| 678 |
return new_str_number;
|
| 679 |
}
|
| 680 |
--
|
| 681 |
1.7.4
|
| 682 |
|