mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-09 04:13:33 +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:
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);
|
g_slice_free(struct session_data, priv->session);
|
||||||
priv->session = NULL;
|
priv->session = NULL;
|
||||||
|
|
||||||
g_free (priv->username);
|
g_clear_pointer (&priv->username, g_free);
|
||||||
priv->username = NULL;
|
g_clear_pointer (&priv->sender, g_free);
|
||||||
g_free (priv->sender);
|
|
||||||
priv->sender = NULL;
|
|
||||||
|
|
||||||
g_set_error(&error, FPRINT_ERROR, FPRINT_ERROR_INTERNAL,
|
g_set_error(&error, FPRINT_ERROR, FPRINT_ERROR_INTERNAL,
|
||||||
"Could not attempt device open, error %d", r);
|
"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);
|
g_slice_free(struct session_data, session);
|
||||||
priv->session = NULL;
|
priv->session = NULL;
|
||||||
|
|
||||||
g_free (priv->sender);
|
g_clear_pointer (&priv->sender, g_free);
|
||||||
priv->sender = NULL;
|
g_clear_pointer (&priv->username, g_free);
|
||||||
|
|
||||||
g_free (priv->username);
|
|
||||||
priv->username = NULL;
|
|
||||||
|
|
||||||
g_debug("released device %d", priv->id);
|
g_debug("released device %d", priv->id);
|
||||||
dbus_g_method_return(context);
|
dbus_g_method_return(context);
|
||||||
@ -1045,8 +1040,7 @@ static void fprint_device_verify_stop(FprintDevice *rdev,
|
|||||||
guint i;
|
guint i;
|
||||||
for (i = 0; priv->identify_data[i] != NULL; i++)
|
for (i = 0; priv->identify_data[i] != NULL; i++)
|
||||||
fp_print_data_free(priv->identify_data[i]);
|
fp_print_data_free(priv->identify_data[i]);
|
||||||
g_free (priv->identify_data);
|
g_clear_pointer (&priv->identify_data, g_free);
|
||||||
priv->identify_data = NULL;
|
|
||||||
}
|
}
|
||||||
if (!priv->disconnected)
|
if (!priv->disconnected)
|
||||||
r = fp_async_identify_stop(priv->dev, identify_stop_cb, context);
|
r = fp_async_identify_stop(priv->dev, identify_stop_cb, context);
|
||||||
|
|||||||
Reference in New Issue
Block a user