diff options
author | Salvador Cuñat <salvador.cunat@gmail.com> | 2019-08-02 00:29:26 +0200 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2019-08-02 08:58:35 +0200 |
commit | 99b51063812b409b031592ae771016d415755a3f (patch) | |
tree | 4655e2138f8037c89aab42e11e07b15c1f85d5e2 /smtk-import/smartrak.c | |
parent | ac1408af5fde896cf0ed331063f99434d835f054 (diff) | |
download | subsurface-99b51063812b409b031592ae771016d415755a3f.tar.gz |
[smtk-import] fix mem leaks on site/location failure management
Signed-off-by: Salvador Cuñat <salvador,cunat@gmail.com>
Diffstat (limited to 'smtk-import/smartrak.c')
-rw-r--r-- | smtk-import/smartrak.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c index 5382d3e6c..968233eda 100644 --- a/smtk-import/smartrak.c +++ b/smtk-import/smartrak.c @@ -336,8 +336,11 @@ static void smtk_build_location(MdbHandle *mdb, char *idx, struct dive_site **lo do { rc = mdb_fetch_row(table); } 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; + } loc_idx = copy_string(col[2]->bind_ptr); site = copy_string(col[1]->bind_ptr); 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 { rc =mdb_fetch_row(table); } 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; + } /* * Create a string for Subsurface's dive site structure with coordinates |