Add sr_config_free()
Due to struct sr_config now containing a GVariant, this needs to be cleaned up after use properly. This is a helper function for that.
This commit is contained in:
parent
003595ac37
commit
722db131a4
13
hwdriver.c
13
hwdriver.c
|
@ -368,6 +368,19 @@ SR_PRIV struct sr_config *sr_config_new(int key, GVariant *data)
|
|||
return src;
|
||||
}
|
||||
|
||||
SR_PRIV void sr_config_free(struct sr_config *src)
|
||||
{
|
||||
|
||||
if (!src || !src->data) {
|
||||
sr_err("%s: invalid data!", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
g_variant_unref(src->data);
|
||||
g_free(src);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information about the given driver or device instance.
|
||||
*
|
||||
|
|
|
@ -114,6 +114,7 @@ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial);
|
|||
|
||||
SR_PRIV void sr_hw_cleanup_all(void);
|
||||
SR_PRIV struct sr_config *sr_config_new(int key, GVariant *data);
|
||||
SR_PRIV void sr_config_free(struct sr_config *src);
|
||||
SR_PRIV int sr_source_remove(int fd);
|
||||
SR_PRIV int sr_source_add(int fd, int events, int timeout,
|
||||
sr_receive_data_callback_t cb, void *cb_data);
|
||||
|
|
Loading…
Reference in New Issue