diff options
author | Anton Lundin <glance@acc.umu.se> | 2014-12-30 00:25:57 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-12-29 16:27:44 -0800 |
commit | 8455b4b35cc7ae58b109b494c69975ac7fc404c5 (patch) | |
tree | 24f029d93fd8c9edebb50ac0a2bc4600f9bc857f | |
parent | 221b5f0ff7eb63efb22da9768a70994c9bb88c0e (diff) | |
download | subsurface-8455b4b35cc7ae58b109b494c69975ac7fc404c5.tar.gz |
Clear stale pointers after free
This is so that we can re-use the same device_data_t in other calls that
doesn't allocate a context for example.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | libdivecomputer.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c index fed448c9c..a990a4fc8 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -854,10 +854,12 @@ const char *do_libdivecomputer_import(device_data_t *data) err = do_device_import(data); /* TODO: Show the logfile to the user on error. */ dc_device_close(data->device); + data->device = NULL; } else if (subsurface_access(data->devname, R_OK | W_OK) != 0) err = translate("gettextFromC", "Insufficient privileges to open the device %s %s (%s)"); dc_context_free(data->context); + data->context = NULL; if (fp) { fclose(fp); |