core: use g_clear_pointer() to avoid explicitly checking and resetting pointers

This commit is contained in:
Ben Chan
2018-10-18 13:17:36 +02:00
committed by Aleksander Morgado
parent 7de6b6f2e1
commit 436f9ef7e6
2 changed files with 4 additions and 16 deletions
+2 -8
View File
@@ -939,10 +939,7 @@ sms_store_next_part (GTask *task)
return;
}
if (ctx->msg_data) {
g_free (ctx->msg_data);
ctx->msg_data = NULL;
}
g_clear_pointer (&ctx->msg_data, g_free);
if (!sms_get_store_or_send_command ((MMSmsPart *)ctx->current->data,
ctx->use_pdu_mode,
@@ -1218,10 +1215,7 @@ sms_send_next_part (GTask *task)
/* Generic send */
if (ctx->msg_data) {
g_free (ctx->msg_data);
ctx->msg_data = NULL;
}
g_clear_pointer (&ctx->msg_data, g_free);
if (!sms_get_store_or_send_command ((MMSmsPart *)ctx->current->data,
ctx->use_pdu_mode,
+2 -8
View File
@@ -2421,14 +2421,8 @@ update_registration_info (MMBroadbandModemMbim *self,
self->priv->current_operator_name = operator_name_take;
}
} else {
if (self->priv->current_operator_id) {
g_free (self->priv->current_operator_id);
self->priv->current_operator_id = NULL;
}
if (self->priv->current_operator_name) {
g_free (self->priv->current_operator_name);
self->priv->current_operator_name = NULL;
}
g_clear_pointer (&self->priv->current_operator_id, g_free);
g_clear_pointer (&self->priv->current_operator_name, g_free);
g_free (operator_id_take);
g_free (operator_name_take);
}