diff --git a/src/atomics_cobalt.c b/src/atomics_cobalt.c index b901f5b..184c633 100644 --- a/src/atomics_cobalt.c +++ b/src/atomics_cobalt.c @@ -162,9 +162,6 @@ atomics_cobalt_device_close (dc_device_t *abstract) libusb_exit (device->context); #endif - // Free memory. - free (device); - return DC_STATUS_SUCCESS; } diff --git a/src/atomics_cobalt_parser.c b/src/atomics_cobalt_parser.c index bf4adcb..a14e539 100644 --- a/src/atomics_cobalt_parser.c +++ b/src/atomics_cobalt_parser.c @@ -48,7 +48,6 @@ static dc_status_t atomics_cobalt_parser_set_data (dc_parser_t *abstract, const static dc_status_t atomics_cobalt_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t atomics_cobalt_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t atomics_cobalt_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t atomics_cobalt_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t atomics_cobalt_parser_vtable = { DC_FAMILY_ATOMICS_COBALT, @@ -56,7 +55,7 @@ static const dc_parser_vtable_t atomics_cobalt_parser_vtable = { atomics_cobalt_parser_get_datetime, /* datetime */ atomics_cobalt_parser_get_field, /* fields */ atomics_cobalt_parser_samples_foreach, /* samples_foreach */ - atomics_cobalt_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -86,16 +85,6 @@ atomics_cobalt_parser_create (dc_parser_t **out, dc_context_t *context) } -static dc_status_t -atomics_cobalt_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t atomics_cobalt_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/citizen_aqualand.c b/src/citizen_aqualand.c index cda3dbc..dc3e9d7 100644 --- a/src/citizen_aqualand.c +++ b/src/citizen_aqualand.c @@ -133,9 +133,6 @@ citizen_aqualand_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/citizen_aqualand_parser.c b/src/citizen_aqualand_parser.c index e9c2659..fd96c79 100644 --- a/src/citizen_aqualand_parser.c +++ b/src/citizen_aqualand_parser.c @@ -40,7 +40,6 @@ static dc_status_t citizen_aqualand_parser_set_data (dc_parser_t *abstract, cons static dc_status_t citizen_aqualand_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t citizen_aqualand_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t citizen_aqualand_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t citizen_aqualand_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t citizen_aqualand_parser_vtable = { DC_FAMILY_CITIZEN_AQUALAND, @@ -48,7 +47,7 @@ static const dc_parser_vtable_t citizen_aqualand_parser_vtable = { citizen_aqualand_parser_get_datetime, /* datetime */ citizen_aqualand_parser_get_field, /* fields */ citizen_aqualand_parser_samples_foreach, /* samples_foreach */ - citizen_aqualand_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -74,16 +73,6 @@ citizen_aqualand_parser_create (dc_parser_t **out, dc_context_t *context) } -static dc_status_t -citizen_aqualand_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t citizen_aqualand_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/cressi_edy.c b/src/cressi_edy.c index e58619b..3bc72c0 100644 --- a/src/cressi_edy.c +++ b/src/cressi_edy.c @@ -342,9 +342,6 @@ cressi_edy_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/cressi_edy_parser.c b/src/cressi_edy_parser.c index 59898f6..6777081 100644 --- a/src/cressi_edy_parser.c +++ b/src/cressi_edy_parser.c @@ -43,7 +43,6 @@ static dc_status_t cressi_edy_parser_set_data (dc_parser_t *abstract, const unsi static dc_status_t cressi_edy_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t cressi_edy_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t cressi_edy_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t cressi_edy_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t cressi_edy_parser_vtable = { DC_FAMILY_CRESSI_EDY, @@ -51,7 +50,7 @@ static const dc_parser_vtable_t cressi_edy_parser_vtable = { cressi_edy_parser_get_datetime, /* datetime */ cressi_edy_parser_get_field, /* fields */ cressi_edy_parser_samples_foreach, /* samples_foreach */ - cressi_edy_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -95,16 +94,6 @@ cressi_edy_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int } -static dc_status_t -cressi_edy_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t cressi_edy_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/cressi_leonardo.c b/src/cressi_leonardo.c index 6ca321d..2c9045e 100644 --- a/src/cressi_leonardo.c +++ b/src/cressi_leonardo.c @@ -150,9 +150,6 @@ cressi_leonardo_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/cressi_leonardo_parser.c b/src/cressi_leonardo_parser.c index b01a37a..ceced18 100644 --- a/src/cressi_leonardo_parser.c +++ b/src/cressi_leonardo_parser.c @@ -41,7 +41,6 @@ static dc_status_t cressi_leonardo_parser_set_data (dc_parser_t *abstract, const static dc_status_t cressi_leonardo_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t cressi_leonardo_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t cressi_leonardo_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t cressi_leonardo_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t cressi_leonardo_parser_vtable = { DC_FAMILY_CRESSI_EDY, @@ -49,7 +48,7 @@ static const dc_parser_vtable_t cressi_leonardo_parser_vtable = { cressi_leonardo_parser_get_datetime, /* datetime */ cressi_leonardo_parser_get_field, /* fields */ cressi_leonardo_parser_samples_foreach, /* samples_foreach */ - cressi_leonardo_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -75,16 +74,6 @@ cressi_leonardo_parser_create (dc_parser_t **out, dc_context_t *context) } -static dc_status_t -cressi_leonardo_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t cressi_leonardo_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/device.c b/src/device.c index 504b8cf..8758480 100644 --- a/src/device.c +++ b/src/device.c @@ -327,17 +327,22 @@ dc_device_foreach (dc_device_t *device, dc_dive_callback_t callback, void *userd dc_status_t dc_device_close (dc_device_t *device) { + dc_status_t status = DC_STATUS_SUCCESS; + if (device == NULL) return DC_STATUS_SUCCESS; - if (device->vtable->close == NULL) - return DC_STATUS_UNSUPPORTED; - // Disable the cancellation callback. device->cancel_callback = NULL; device->cancel_userdata = NULL; - return device->vtable->close (device); + if (device->vtable->close) { + status = device->vtable->close (device); + } + + free (device); + + return status; } diff --git a/src/diverite_nitekq.c b/src/diverite_nitekq.c index 1d8b96a..fc819a1 100644 --- a/src/diverite_nitekq.c +++ b/src/diverite_nitekq.c @@ -229,9 +229,6 @@ diverite_nitekq_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/diverite_nitekq_parser.c b/src/diverite_nitekq_parser.c index f65ba38..a32efa1 100644 --- a/src/diverite_nitekq_parser.c +++ b/src/diverite_nitekq_parser.c @@ -52,7 +52,6 @@ static dc_status_t diverite_nitekq_parser_set_data (dc_parser_t *abstract, const static dc_status_t diverite_nitekq_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t diverite_nitekq_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t diverite_nitekq_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t diverite_nitekq_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t diverite_nitekq_parser_vtable = { DC_FAMILY_DIVERITE_NITEKQ, @@ -60,7 +59,7 @@ static const dc_parser_vtable_t diverite_nitekq_parser_vtable = { diverite_nitekq_parser_get_datetime, /* datetime */ diverite_nitekq_parser_get_field, /* fields */ diverite_nitekq_parser_samples_foreach, /* samples_foreach */ - diverite_nitekq_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -97,16 +96,6 @@ diverite_nitekq_parser_create (dc_parser_t **out, dc_context_t *context) } -static dc_status_t -diverite_nitekq_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t diverite_nitekq_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/divesystem_idive.c b/src/divesystem_idive.c index e4eec6a..9565386 100644 --- a/src/divesystem_idive.c +++ b/src/divesystem_idive.c @@ -181,9 +181,6 @@ divesystem_idive_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/divesystem_idive_parser.c b/src/divesystem_idive_parser.c index 81d1b3d..5ea2052 100644 --- a/src/divesystem_idive_parser.c +++ b/src/divesystem_idive_parser.c @@ -62,7 +62,6 @@ static dc_status_t divesystem_idive_parser_set_data (dc_parser_t *abstract, cons static dc_status_t divesystem_idive_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t divesystem_idive_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t divesystem_idive_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t divesystem_idive_parser_vtable = { DC_FAMILY_DIVESYSTEM_IDIVE, @@ -70,7 +69,7 @@ static const dc_parser_vtable_t divesystem_idive_parser_vtable = { divesystem_idive_parser_get_datetime, /* datetime */ divesystem_idive_parser_get_field, /* fields */ divesystem_idive_parser_samples_foreach, /* samples_foreach */ - divesystem_idive_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -120,16 +119,6 @@ divesystem_idive_parser_create2 (dc_parser_t **out, dc_context_t *context, unsig } -static dc_status_t -divesystem_idive_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t divesystem_idive_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/hw_frog.c b/src/hw_frog.c index 48c9175..339c5ef 100644 --- a/src/hw_frog.c +++ b/src/hw_frog.c @@ -287,9 +287,6 @@ hw_frog_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/hw_ostc.c b/src/hw_ostc.c index 42dc778..d69c3df 100644 --- a/src/hw_ostc.c +++ b/src/hw_ostc.c @@ -195,9 +195,6 @@ hw_ostc_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/hw_ostc3.c b/src/hw_ostc3.c index 20cbe8d..a2befa0 100644 --- a/src/hw_ostc3.c +++ b/src/hw_ostc3.c @@ -448,9 +448,6 @@ hw_ostc3_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index 5a6d02f..5ee2097 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -97,7 +97,6 @@ static dc_status_t hw_ostc_parser_set_data (dc_parser_t *abstract, const unsigne static dc_status_t hw_ostc_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t hw_ostc_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t hw_ostc_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t hw_ostc_parser_vtable = { DC_FAMILY_HW_OSTC, @@ -105,7 +104,7 @@ static const dc_parser_vtable_t hw_ostc_parser_vtable = { hw_ostc_parser_get_datetime, /* datetime */ hw_ostc_parser_get_field, /* fields */ hw_ostc_parser_samples_foreach, /* samples_foreach */ - hw_ostc_parser_destroy /* destroy */ + NULL /* destroy */ }; static const hw_ostc_layout_t hw_ostc_layout_ostc = { @@ -300,16 +299,6 @@ hw_ostc_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int fr } -static dc_status_t -hw_ostc_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t hw_ostc_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/mares_darwin.c b/src/mares_darwin.c index 5ab153d..d12172f 100644 --- a/src/mares_darwin.c +++ b/src/mares_darwin.c @@ -181,9 +181,6 @@ mares_darwin_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/mares_darwin_parser.c b/src/mares_darwin_parser.c index 5de4c4b..67ae51c 100644 --- a/src/mares_darwin_parser.c +++ b/src/mares_darwin_parser.c @@ -47,7 +47,6 @@ static dc_status_t mares_darwin_parser_set_data (dc_parser_t *abstract, const un static dc_status_t mares_darwin_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t mares_darwin_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t mares_darwin_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t mares_darwin_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t mares_darwin_parser_vtable = { DC_FAMILY_MARES_DARWIN, @@ -55,7 +54,7 @@ static const dc_parser_vtable_t mares_darwin_parser_vtable = { mares_darwin_parser_get_datetime, /* datetime */ mares_darwin_parser_get_field, /* fields */ mares_darwin_parser_samples_foreach, /* samples_foreach */ - mares_darwin_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -91,16 +90,6 @@ mares_darwin_parser_create (dc_parser_t **out, dc_context_t *context, unsigned i } -static dc_status_t -mares_darwin_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t mares_darwin_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c index 488852c..123b103 100644 --- a/src/mares_iconhd.c +++ b/src/mares_iconhd.c @@ -332,9 +332,6 @@ mares_iconhd_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/mares_iconhd_parser.c b/src/mares_iconhd_parser.c index 51b1fd4..728162e 100644 --- a/src/mares_iconhd_parser.c +++ b/src/mares_iconhd_parser.c @@ -60,7 +60,6 @@ static dc_status_t mares_iconhd_parser_set_data (dc_parser_t *abstract, const un static dc_status_t mares_iconhd_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t mares_iconhd_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t mares_iconhd_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t mares_iconhd_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t mares_iconhd_parser_vtable = { DC_FAMILY_MARES_ICONHD, @@ -68,7 +67,7 @@ static const dc_parser_vtable_t mares_iconhd_parser_vtable = { mares_iconhd_parser_get_datetime, /* datetime */ mares_iconhd_parser_get_field, /* fields */ mares_iconhd_parser_samples_foreach, /* samples_foreach */ - mares_iconhd_parser_destroy /* destroy */ + NULL /* destroy */ }; static dc_status_t @@ -229,16 +228,6 @@ mares_iconhd_parser_create (dc_parser_t **out, dc_context_t *context, unsigned i } -static dc_status_t -mares_iconhd_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t mares_iconhd_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/mares_nemo.c b/src/mares_nemo.c index 2b40905..e6a1bb8 100644 --- a/src/mares_nemo.c +++ b/src/mares_nemo.c @@ -167,9 +167,6 @@ mares_nemo_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/mares_nemo_parser.c b/src/mares_nemo_parser.c index b997ae4..487b5f2 100644 --- a/src/mares_nemo_parser.c +++ b/src/mares_nemo_parser.c @@ -63,7 +63,6 @@ static dc_status_t mares_nemo_parser_set_data (dc_parser_t *abstract, const unsi static dc_status_t mares_nemo_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t mares_nemo_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t mares_nemo_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t mares_nemo_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t mares_nemo_parser_vtable = { DC_FAMILY_MARES_NEMO, @@ -71,7 +70,7 @@ static const dc_parser_vtable_t mares_nemo_parser_vtable = { mares_nemo_parser_get_datetime, /* datetime */ mares_nemo_parser_get_field, /* fields */ mares_nemo_parser_samples_foreach, /* samples_foreach */ - mares_nemo_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -112,16 +111,6 @@ mares_nemo_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int } -static dc_status_t -mares_nemo_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t mares_nemo_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/mares_puck.c b/src/mares_puck.c index 07448c0..95ba855 100644 --- a/src/mares_puck.c +++ b/src/mares_puck.c @@ -189,9 +189,6 @@ mares_puck_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 26f6fd3..93aa5da 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -662,9 +662,6 @@ oceanic_atom2_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index 99d5602..a6f39ec 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -107,7 +107,6 @@ static dc_status_t oceanic_atom2_parser_set_data (dc_parser_t *abstract, const u static dc_status_t oceanic_atom2_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t oceanic_atom2_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t oceanic_atom2_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t oceanic_atom2_parser_vtable = { DC_FAMILY_OCEANIC_ATOM2, @@ -115,7 +114,7 @@ static const dc_parser_vtable_t oceanic_atom2_parser_vtable = { oceanic_atom2_parser_get_datetime, /* datetime */ oceanic_atom2_parser_get_field, /* fields */ oceanic_atom2_parser_samples_foreach, /* samples_foreach */ - oceanic_atom2_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -180,16 +179,6 @@ oceanic_atom2_parser_create (dc_parser_t **out, dc_context_t *context, unsigned } -static dc_status_t -oceanic_atom2_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t oceanic_atom2_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/oceanic_veo250.c b/src/oceanic_veo250.c index d2b5d6e..15d8070 100644 --- a/src/oceanic_veo250.c +++ b/src/oceanic_veo250.c @@ -325,9 +325,6 @@ oceanic_veo250_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/oceanic_veo250_parser.c b/src/oceanic_veo250_parser.c index 36eeeb4..4cc8ebe 100644 --- a/src/oceanic_veo250_parser.c +++ b/src/oceanic_veo250_parser.c @@ -51,7 +51,6 @@ static dc_status_t oceanic_veo250_parser_set_data (dc_parser_t *abstract, const static dc_status_t oceanic_veo250_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t oceanic_veo250_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t oceanic_veo250_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t oceanic_veo250_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t oceanic_veo250_parser_vtable = { DC_FAMILY_OCEANIC_VEO250, @@ -59,7 +58,7 @@ static const dc_parser_vtable_t oceanic_veo250_parser_vtable = { oceanic_veo250_parser_get_datetime, /* datetime */ oceanic_veo250_parser_get_field, /* fields */ oceanic_veo250_parser_samples_foreach, /* samples_foreach */ - oceanic_veo250_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -91,16 +90,6 @@ oceanic_veo250_parser_create (dc_parser_t **out, dc_context_t *context, unsigned } -static dc_status_t -oceanic_veo250_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t oceanic_veo250_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/oceanic_vtpro.c b/src/oceanic_vtpro.c index 0bce08e..67867b7 100644 --- a/src/oceanic_vtpro.c +++ b/src/oceanic_vtpro.c @@ -368,9 +368,6 @@ oceanic_vtpro_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/oceanic_vtpro_parser.c b/src/oceanic_vtpro_parser.c index f7d2be5..c1b5150 100644 --- a/src/oceanic_vtpro_parser.c +++ b/src/oceanic_vtpro_parser.c @@ -45,7 +45,6 @@ static dc_status_t oceanic_vtpro_parser_set_data (dc_parser_t *abstract, const u static dc_status_t oceanic_vtpro_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t oceanic_vtpro_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t oceanic_vtpro_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t oceanic_vtpro_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t oceanic_vtpro_parser_vtable = { DC_FAMILY_OCEANIC_VTPRO, @@ -53,7 +52,7 @@ static const dc_parser_vtable_t oceanic_vtpro_parser_vtable = { oceanic_vtpro_parser_get_datetime, /* datetime */ oceanic_vtpro_parser_get_field, /* fields */ oceanic_vtpro_parser_samples_foreach, /* samples_foreach */ - oceanic_vtpro_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -84,16 +83,6 @@ oceanic_vtpro_parser_create (dc_parser_t **out, dc_context_t *context) } -static dc_status_t -oceanic_vtpro_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t oceanic_vtpro_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/parser.c b/src/parser.c index 5f9a7a7..bc6b406 100644 --- a/src/parser.c +++ b/src/parser.c @@ -239,13 +239,18 @@ dc_parser_samples_foreach (dc_parser_t *parser, dc_sample_callback_t callback, v dc_status_t dc_parser_destroy (dc_parser_t *parser) { + dc_status_t status = DC_STATUS_SUCCESS; + if (parser == NULL) return DC_STATUS_SUCCESS; - if (parser->vtable->destroy == NULL) - return DC_STATUS_UNSUPPORTED; + if (parser->vtable->destroy) { + status = parser->vtable->destroy (parser); + } - return parser->vtable->destroy (parser); + free (parser); + + return status; } diff --git a/src/reefnet_sensus.c b/src/reefnet_sensus.c index c4cc685..ba40ee5 100644 --- a/src/reefnet_sensus.c +++ b/src/reefnet_sensus.c @@ -167,9 +167,6 @@ reefnet_sensus_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/reefnet_sensus_parser.c b/src/reefnet_sensus_parser.c index 9b5de72..b5702f2 100644 --- a/src/reefnet_sensus_parser.c +++ b/src/reefnet_sensus_parser.c @@ -52,7 +52,6 @@ static dc_status_t reefnet_sensus_parser_set_data (dc_parser_t *abstract, const static dc_status_t reefnet_sensus_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t reefnet_sensus_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t reefnet_sensus_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t reefnet_sensus_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t reefnet_sensus_parser_vtable = { DC_FAMILY_REEFNET_SENSUS, @@ -60,7 +59,7 @@ static const dc_parser_vtable_t reefnet_sensus_parser_vtable = { reefnet_sensus_parser_get_datetime, /* datetime */ reefnet_sensus_parser_get_field, /* fields */ reefnet_sensus_parser_samples_foreach, /* samples_foreach */ - reefnet_sensus_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -95,16 +94,6 @@ reefnet_sensus_parser_create (dc_parser_t **out, dc_context_t *context, unsigned } -static dc_status_t -reefnet_sensus_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t reefnet_sensus_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/reefnet_sensuspro.c b/src/reefnet_sensuspro.c index f1bb9ca..1063166 100644 --- a/src/reefnet_sensuspro.c +++ b/src/reefnet_sensuspro.c @@ -140,9 +140,6 @@ reefnet_sensuspro_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/reefnet_sensuspro_parser.c b/src/reefnet_sensuspro_parser.c index 0f3af95..cc9d999 100644 --- a/src/reefnet_sensuspro_parser.c +++ b/src/reefnet_sensuspro_parser.c @@ -51,7 +51,6 @@ static dc_status_t reefnet_sensuspro_parser_set_data (dc_parser_t *abstract, con static dc_status_t reefnet_sensuspro_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t reefnet_sensuspro_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t reefnet_sensuspro_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t reefnet_sensuspro_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t reefnet_sensuspro_parser_vtable = { DC_FAMILY_REEFNET_SENSUSPRO, @@ -59,7 +58,7 @@ static const dc_parser_vtable_t reefnet_sensuspro_parser_vtable = { reefnet_sensuspro_parser_get_datetime, /* datetime */ reefnet_sensuspro_parser_get_field, /* fields */ reefnet_sensuspro_parser_samples_foreach, /* samples_foreach */ - reefnet_sensuspro_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -94,16 +93,6 @@ reefnet_sensuspro_parser_create (dc_parser_t **out, dc_context_t *context, unsig } -static dc_status_t -reefnet_sensuspro_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t reefnet_sensuspro_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/reefnet_sensusultra.c b/src/reefnet_sensusultra.c index c52d7b3..d246c14 100644 --- a/src/reefnet_sensusultra.c +++ b/src/reefnet_sensusultra.c @@ -149,9 +149,6 @@ reefnet_sensusultra_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/reefnet_sensusultra_parser.c b/src/reefnet_sensusultra_parser.c index 1d85b06..339fa0d 100644 --- a/src/reefnet_sensusultra_parser.c +++ b/src/reefnet_sensusultra_parser.c @@ -51,7 +51,6 @@ static dc_status_t reefnet_sensusultra_parser_set_data (dc_parser_t *abstract, c static dc_status_t reefnet_sensusultra_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t reefnet_sensusultra_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t reefnet_sensusultra_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t reefnet_sensusultra_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t reefnet_sensusultra_parser_vtable = { DC_FAMILY_REEFNET_SENSUSULTRA, @@ -59,7 +58,7 @@ static const dc_parser_vtable_t reefnet_sensusultra_parser_vtable = { reefnet_sensusultra_parser_get_datetime, /* datetime */ reefnet_sensusultra_parser_get_field, /* fields */ reefnet_sensusultra_parser_samples_foreach, /* samples_foreach */ - reefnet_sensusultra_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -94,16 +93,6 @@ reefnet_sensusultra_parser_create (dc_parser_t **out, dc_context_t *context, uns } -static dc_status_t -reefnet_sensusultra_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t reefnet_sensusultra_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/shearwater_petrel.c b/src/shearwater_petrel.c index 1bf98f5..f5e6d76 100644 --- a/src/shearwater_petrel.c +++ b/src/shearwater_petrel.c @@ -117,7 +117,6 @@ error_free: static dc_status_t shearwater_petrel_device_close (dc_device_t *abstract) { - dc_status_t rc = DC_STATUS_SUCCESS; shearwater_common_device_t *device = (shearwater_common_device_t *) abstract; // Shutdown the device. @@ -125,12 +124,7 @@ shearwater_petrel_device_close (dc_device_t *abstract) shearwater_common_transfer (device, request, sizeof (request), NULL, 0, NULL); // Close the device. - rc = shearwater_common_close (device); - - // Free memory. - free (device); - - return rc; + return shearwater_common_close (device); } diff --git a/src/shearwater_predator.c b/src/shearwater_predator.c index 7fa6f83..f5cfbc6 100644 --- a/src/shearwater_predator.c +++ b/src/shearwater_predator.c @@ -103,16 +103,9 @@ error_free: static dc_status_t shearwater_predator_device_close (dc_device_t *abstract) { - dc_status_t rc = DC_STATUS_SUCCESS; shearwater_common_device_t *device = (shearwater_common_device_t *) abstract; - // Close the device. - rc = shearwater_common_close (device); - - // Free memory. - free (device); - - return rc; + return shearwater_common_close (device); } diff --git a/src/shearwater_predator_parser.c b/src/shearwater_predator_parser.c index 1423e77..cacdcca 100644 --- a/src/shearwater_predator_parser.c +++ b/src/shearwater_predator_parser.c @@ -67,7 +67,6 @@ static dc_status_t shearwater_predator_parser_set_data (dc_parser_t *abstract, c static dc_status_t shearwater_predator_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t shearwater_predator_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t shearwater_predator_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t shearwater_predator_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t shearwater_predator_parser_vtable = { DC_FAMILY_SHEARWATER_PREDATOR, @@ -75,7 +74,7 @@ static const dc_parser_vtable_t shearwater_predator_parser_vtable = { shearwater_predator_parser_get_datetime, /* datetime */ shearwater_predator_parser_get_field, /* fields */ shearwater_predator_parser_samples_foreach, /* samples_foreach */ - shearwater_predator_parser_destroy /* destroy */ + NULL /* destroy */ }; static const dc_parser_vtable_t shearwater_petrel_parser_vtable = { @@ -84,7 +83,7 @@ static const dc_parser_vtable_t shearwater_petrel_parser_vtable = { shearwater_predator_parser_get_datetime, /* datetime */ shearwater_predator_parser_get_field, /* fields */ shearwater_predator_parser_samples_foreach, /* samples_foreach */ - shearwater_predator_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -155,16 +154,6 @@ shearwater_petrel_parser_create (dc_parser_t **out, dc_context_t *context) } -static dc_status_t -shearwater_predator_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t shearwater_predator_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/suunto_d9.c b/src/suunto_d9.c index 708070a..ce3ff89 100644 --- a/src/suunto_d9.c +++ b/src/suunto_d9.c @@ -223,9 +223,6 @@ suunto_d9_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/suunto_d9_parser.c b/src/suunto_d9_parser.c index c59ac48..adda93b 100644 --- a/src/suunto_d9_parser.c +++ b/src/suunto_d9_parser.c @@ -83,7 +83,6 @@ static dc_status_t suunto_d9_parser_set_data (dc_parser_t *abstract, const unsig static dc_status_t suunto_d9_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t suunto_d9_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t suunto_d9_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t suunto_d9_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t suunto_d9_parser_vtable = { DC_FAMILY_SUUNTO_D9, @@ -91,7 +90,7 @@ static const dc_parser_vtable_t suunto_d9_parser_vtable = { suunto_d9_parser_get_datetime, /* datetime */ suunto_d9_parser_get_field, /* fields */ suunto_d9_parser_samples_foreach, /* samples_foreach */ - suunto_d9_parser_destroy /* destroy */ + NULL /* destroy */ }; static unsigned int @@ -234,16 +233,6 @@ suunto_d9_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int } -static dc_status_t -suunto_d9_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t suunto_d9_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/suunto_eon.c b/src/suunto_eon.c index 01b2743..306dac5 100644 --- a/src/suunto_eon.c +++ b/src/suunto_eon.c @@ -143,9 +143,6 @@ suunto_eon_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/suunto_eon_parser.c b/src/suunto_eon_parser.c index a803801..be38d7f 100644 --- a/src/suunto_eon_parser.c +++ b/src/suunto_eon_parser.c @@ -47,7 +47,6 @@ static dc_status_t suunto_eon_parser_set_data (dc_parser_t *abstract, const unsi static dc_status_t suunto_eon_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t suunto_eon_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t suunto_eon_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t suunto_eon_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t suunto_eon_parser_vtable = { DC_FAMILY_SUUNTO_EON, @@ -55,7 +54,7 @@ static const dc_parser_vtable_t suunto_eon_parser_vtable = { suunto_eon_parser_get_datetime, /* datetime */ suunto_eon_parser_get_field, /* fields */ suunto_eon_parser_samples_foreach, /* samples_foreach */ - suunto_eon_parser_destroy /* destroy */ + NULL /* destroy */ }; static dc_status_t @@ -138,16 +137,6 @@ suunto_eon_parser_create (dc_parser_t **out, dc_context_t *context, int spyder) } -static dc_status_t -suunto_eon_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t suunto_eon_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/suunto_eonsteel.c b/src/suunto_eonsteel.c index 8bd0350..03b6f99 100644 --- a/src/suunto_eonsteel.c +++ b/src/suunto_eonsteel.c @@ -696,7 +696,6 @@ suunto_eonsteel_device_close(dc_device_t *abstract) libusb_close(eon->handle); libusb_exit(eon->ctx); - free(eon); return DC_STATUS_SUCCESS; } diff --git a/src/suunto_eonsteel_parser.c b/src/suunto_eonsteel_parser.c index 2e31c90..e638bde 100644 --- a/src/suunto_eonsteel_parser.c +++ b/src/suunto_eonsteel_parser.c @@ -1191,7 +1191,7 @@ suunto_eonsteel_parser_destroy(dc_parser_t *parser) suunto_eonsteel_parser_t *eon = (suunto_eonsteel_parser_t *) parser; desc_free(eon->type_desc, MAXTYPE); - free(parser); + return DC_STATUS_SUCCESS; } diff --git a/src/suunto_solution.c b/src/suunto_solution.c index 2a2e8de..3ff1f60 100644 --- a/src/suunto_solution.c +++ b/src/suunto_solution.c @@ -137,9 +137,6 @@ suunto_solution_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/suunto_solution_parser.c b/src/suunto_solution_parser.c index 94e146a..8a6ad62 100644 --- a/src/suunto_solution_parser.c +++ b/src/suunto_solution_parser.c @@ -42,7 +42,6 @@ struct suunto_solution_parser_t { static dc_status_t suunto_solution_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size); static dc_status_t suunto_solution_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t suunto_solution_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t suunto_solution_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t suunto_solution_parser_vtable = { DC_FAMILY_SUUNTO_SOLUTION, @@ -50,7 +49,7 @@ static const dc_parser_vtable_t suunto_solution_parser_vtable = { NULL, /* datetime */ suunto_solution_parser_get_field, /* fields */ suunto_solution_parser_samples_foreach, /* samples_foreach */ - suunto_solution_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -81,16 +80,6 @@ suunto_solution_parser_create (dc_parser_t **out, dc_context_t *context) } -static dc_status_t -suunto_solution_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t suunto_solution_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/suunto_vyper.c b/src/suunto_vyper.c index a6bbfc1..701fbeb 100644 --- a/src/suunto_vyper.c +++ b/src/suunto_vyper.c @@ -169,9 +169,6 @@ suunto_vyper_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/suunto_vyper2.c b/src/suunto_vyper2.c index 66d3859..e701164 100644 --- a/src/suunto_vyper2.c +++ b/src/suunto_vyper2.c @@ -175,9 +175,6 @@ suunto_vyper2_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/suunto_vyper_parser.c b/src/suunto_vyper_parser.c index 4e2d974..4628cb1 100644 --- a/src/suunto_vyper_parser.c +++ b/src/suunto_vyper_parser.c @@ -48,7 +48,6 @@ static dc_status_t suunto_vyper_parser_set_data (dc_parser_t *abstract, const un static dc_status_t suunto_vyper_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t suunto_vyper_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t suunto_vyper_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t suunto_vyper_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t suunto_vyper_parser_vtable = { DC_FAMILY_SUUNTO_VYPER, @@ -56,7 +55,7 @@ static const dc_parser_vtable_t suunto_vyper_parser_vtable = { suunto_vyper_parser_get_datetime, /* datetime */ suunto_vyper_parser_get_field, /* fields */ suunto_vyper_parser_samples_foreach, /* samples_foreach */ - suunto_vyper_parser_destroy /* destroy */ + NULL /* destroy */ }; static unsigned int @@ -190,16 +189,6 @@ suunto_vyper_parser_create (dc_parser_t **out, dc_context_t *context) } -static dc_status_t -suunto_vyper_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t suunto_vyper_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/uwatec_aladin.c b/src/uwatec_aladin.c index d4b1c83..7cd7dff 100644 --- a/src/uwatec_aladin.c +++ b/src/uwatec_aladin.c @@ -150,9 +150,6 @@ uwatec_aladin_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/uwatec_memomouse.c b/src/uwatec_memomouse.c index 12fc7a8..29b2c69 100644 --- a/src/uwatec_memomouse.c +++ b/src/uwatec_memomouse.c @@ -149,9 +149,6 @@ uwatec_memomouse_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/uwatec_memomouse_parser.c b/src/uwatec_memomouse_parser.c index a47cdc4..98fc25d 100644 --- a/src/uwatec_memomouse_parser.c +++ b/src/uwatec_memomouse_parser.c @@ -42,7 +42,6 @@ static dc_status_t uwatec_memomouse_parser_set_data (dc_parser_t *abstract, cons static dc_status_t uwatec_memomouse_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t uwatec_memomouse_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t uwatec_memomouse_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t uwatec_memomouse_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t uwatec_memomouse_parser_vtable = { DC_FAMILY_UWATEC_MEMOMOUSE, @@ -50,7 +49,7 @@ static const dc_parser_vtable_t uwatec_memomouse_parser_vtable = { uwatec_memomouse_parser_get_datetime, /* datetime */ uwatec_memomouse_parser_get_field, /* fields */ uwatec_memomouse_parser_samples_foreach, /* samples_foreach */ - uwatec_memomouse_parser_destroy /* destroy */ + NULL /* destroy */ }; @@ -80,16 +79,6 @@ uwatec_memomouse_parser_create (dc_parser_t **out, dc_context_t *context, unsign } -static dc_status_t -uwatec_memomouse_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t uwatec_memomouse_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/uwatec_meridian.c b/src/uwatec_meridian.c index 3689592..dda19bd 100644 --- a/src/uwatec_meridian.c +++ b/src/uwatec_meridian.c @@ -260,9 +260,6 @@ uwatec_meridian_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/uwatec_smart.c b/src/uwatec_smart.c index 7d27cb5..2d45294 100644 --- a/src/uwatec_smart.c +++ b/src/uwatec_smart.c @@ -224,9 +224,6 @@ uwatec_smart_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; } diff --git a/src/uwatec_smart_parser.c b/src/uwatec_smart_parser.c index c06e5e2..1fe57d7 100644 --- a/src/uwatec_smart_parser.c +++ b/src/uwatec_smart_parser.c @@ -150,7 +150,6 @@ static dc_status_t uwatec_smart_parser_set_data (dc_parser_t *abstract, const un static dc_status_t uwatec_smart_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime); static dc_status_t uwatec_smart_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value); static dc_status_t uwatec_smart_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata); -static dc_status_t uwatec_smart_parser_destroy (dc_parser_t *abstract); static const dc_parser_vtable_t uwatec_smart_parser_vtable = { DC_FAMILY_UWATEC_SMART, @@ -158,7 +157,7 @@ static const dc_parser_vtable_t uwatec_smart_parser_vtable = { uwatec_smart_parser_get_datetime, /* datetime */ uwatec_smart_parser_get_field, /* fields */ uwatec_smart_parser_samples_foreach, /* samples_foreach */ - uwatec_smart_parser_destroy /* destroy */ + NULL /* destroy */ }; static const @@ -626,16 +625,6 @@ error_free: } -static dc_status_t -uwatec_smart_parser_destroy (dc_parser_t *abstract) -{ - // Free memory. - free (abstract); - - return DC_STATUS_SUCCESS; -} - - static dc_status_t uwatec_smart_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/zeagle_n2ition3.c b/src/zeagle_n2ition3.c index 2559a5a..ff7f8c2 100644 --- a/src/zeagle_n2ition3.c +++ b/src/zeagle_n2ition3.c @@ -209,9 +209,6 @@ zeagle_n2ition3_device_close (dc_device_t *abstract) dc_status_set_error(&status, DC_STATUS_IO); } - // Free memory. - free (device); - return status; }