mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
[smtk-import] fix mem leaks on site/location failure management
Signed-off-by: Salvador Cuñat <salvador,cunat@gmail.com>
This commit is contained in:
parent
ac1408af5f
commit
99b5106381
1 changed files with 10 additions and 2 deletions
|
@ -336,8 +336,11 @@ static void smtk_build_location(MdbHandle *mdb, char *idx, struct dive_site **lo
|
||||||
do {
|
do {
|
||||||
rc = mdb_fetch_row(table);
|
rc = mdb_fetch_row(table);
|
||||||
} while (strcasecmp(col[0]->bind_ptr, idx) && rc != 0);
|
} while (strcasecmp(col[0]->bind_ptr, idx) && rc != 0);
|
||||||
if (rc == 0)
|
if (rc == 0) {
|
||||||
|
smtk_free(bound_values, table->num_cols);
|
||||||
|
mdb_free_tabledef(table);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
loc_idx = copy_string(col[2]->bind_ptr);
|
loc_idx = copy_string(col[2]->bind_ptr);
|
||||||
site = copy_string(col[1]->bind_ptr);
|
site = copy_string(col[1]->bind_ptr);
|
||||||
loc = create_location(strtod(col[6]->bind_ptr, NULL), strtod(col[7]->bind_ptr, NULL));
|
loc = create_location(strtod(col[6]->bind_ptr, NULL), strtod(col[7]->bind_ptr, NULL));
|
||||||
|
@ -365,8 +368,13 @@ static void smtk_build_location(MdbHandle *mdb, char *idx, struct dive_site **lo
|
||||||
do {
|
do {
|
||||||
rc =mdb_fetch_row(table);
|
rc =mdb_fetch_row(table);
|
||||||
} while (strcasecmp(col[0]->bind_ptr, loc_idx) && rc != 0);
|
} while (strcasecmp(col[0]->bind_ptr, loc_idx) && rc != 0);
|
||||||
if (rc == 0)
|
if (rc == 0){
|
||||||
|
smtk_free(bound_values, table->num_cols);
|
||||||
|
mdb_free_tabledef(table);
|
||||||
|
if(notes)
|
||||||
|
free(notes);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a string for Subsurface's dive site structure with coordinates
|
* Create a string for Subsurface's dive site structure with coordinates
|
||||||
|
|
Loading…
Reference in a new issue