mirror of
https://gitlab.freedesktop.org/libfprint/fprintd.git
synced 2026-05-05 20:28:21 +02:00
device: Use g_clear_pointer in places
Replace some g_free calls with subsequent NULL setting with g_clear_pointer.
This commit is contained in:
parent
31ba9ebea4
commit
16cb1a8ec6
1 changed files with 5 additions and 11 deletions
16
src/device.c
16
src/device.c
|
|
@ -683,10 +683,8 @@ static void fprint_device_claim(FprintDevice *rdev,
|
|||
g_slice_free(struct session_data, priv->session);
|
||||
priv->session = NULL;
|
||||
|
||||
g_free (priv->username);
|
||||
priv->username = NULL;
|
||||
g_free (priv->sender);
|
||||
priv->sender = NULL;
|
||||
g_clear_pointer (&priv->username, g_free);
|
||||
g_clear_pointer (&priv->sender, g_free);
|
||||
|
||||
g_set_error(&error, FPRINT_ERROR, FPRINT_ERROR_INTERNAL,
|
||||
"Could not attempt device open, error %d", r);
|
||||
|
|
@ -706,11 +704,8 @@ static void dev_close_cb(struct fp_dev *dev, void *user_data)
|
|||
g_slice_free(struct session_data, session);
|
||||
priv->session = NULL;
|
||||
|
||||
g_free (priv->sender);
|
||||
priv->sender = NULL;
|
||||
|
||||
g_free (priv->username);
|
||||
priv->username = NULL;
|
||||
g_clear_pointer (&priv->sender, g_free);
|
||||
g_clear_pointer (&priv->username, g_free);
|
||||
|
||||
g_debug("released device %d", priv->id);
|
||||
dbus_g_method_return(context);
|
||||
|
|
@ -1045,8 +1040,7 @@ static void fprint_device_verify_stop(FprintDevice *rdev,
|
|||
guint i;
|
||||
for (i = 0; priv->identify_data[i] != NULL; i++)
|
||||
fp_print_data_free(priv->identify_data[i]);
|
||||
g_free (priv->identify_data);
|
||||
priv->identify_data = NULL;
|
||||
g_clear_pointer (&priv->identify_data, g_free);
|
||||
}
|
||||
if (!priv->disconnected)
|
||||
r = fp_async_identify_stop(priv->dev, identify_stop_cb, context);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue