diff options
author | Ben Chan <benchan@chromium.org> | 2018-10-17 23:06:47 -0700 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2018-10-18 13:17:36 +0200 |
commit | 749b806c30b41512dec4901808976425cdf3e56b (patch) | |
tree | 78cb67b2b673866583e3b17617adcfac30dbbc57 | |
parent | 4156fd27186a517fcae938aaf23783000f6f34aa (diff) | |
download | ModemManager-749b806c30b41512dec4901808976425cdf3e56b.tar.gz |
core: remove unnecessary NULL checks for g_free()
g_free() already check if the given pointer is NULL and does nothing on
a NULL pointer.
-rw-r--r-- | libmm-glib/mm-location-gps-raw.c | 3 | ||||
-rw-r--r-- | src/mm-base-sms.c | 6 | ||||
-rw-r--r-- | src/mm-broadband-bearer.c | 3 |
3 files changed, 4 insertions, 8 deletions
diff --git a/libmm-glib/mm-location-gps-raw.c b/libmm-glib/mm-location-gps-raw.c index 5241ba7c3..4cfe7f089 100644 --- a/libmm-glib/mm-location-gps-raw.c +++ b/libmm-glib/mm-location-gps-raw.c @@ -217,8 +217,7 @@ mm_location_gps_raw_add_trace (MMLocationGpsRaw *self, if (g_regex_match (self->priv->gga_regex, trace, 0, &match_info)) { /* UTC time */ - if (self->priv->utc_time) - g_free (self->priv->utc_time); + g_free (self->priv->utc_time); self->priv->utc_time = g_match_info_fetch (match_info, 1); /* Latitude */ diff --git a/src/mm-base-sms.c b/src/mm-base-sms.c index f9c16013c..e117bef71 100644 --- a/src/mm-base-sms.c +++ b/src/mm-base-sms.c @@ -215,10 +215,8 @@ generate_3gpp_submit_pdus (MMBaseSms *self, } /* Free array (not contents, which were taken for the part) */ - if (split_text) - g_free (split_text); - if (split_data) - g_free (split_data); + g_free (split_text); + g_free (split_data); /* Set additional multipart specific properties */ if (n_parts > 1) { diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c index bf02c13a5..1b13921a2 100644 --- a/src/mm-broadband-bearer.c +++ b/src/mm-broadband-bearer.c @@ -1376,8 +1376,7 @@ detailed_disconnect_finish (MMBroadbandBearer *self, static void detailed_disconnect_context_free (DetailedDisconnectContext *ctx) { - if (ctx->cgact_command) - g_free (ctx->cgact_command); + g_free (ctx->cgact_command); g_object_unref (ctx->data); g_object_unref (ctx->primary); if (ctx->secondary) |