From a74d2c58babd2e85a4d1920e0144b5c7ee2231d0 Mon Sep 17 00:00:00 2001
From: Dylan Van Assche <me@dylanvanassche.be>
Date: Wed, 12 May 2021 16:41:48 +0200
Subject: [PATCH 4/8] at: g_free doesn't require NULL checking

From the docs: If mem is NULL it simply returns, so there is no need to check mem against NULL before calling this function.
---
 src/at.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/at.c b/src/at.c
index 4469d26..3ccc5d6 100644
--- a/src/at.c
+++ b/src/at.c
@@ -104,14 +104,10 @@ static void next_at_command(struct EG25Manager *manager)
     if (!at_cmd)
         return;
 
-    if (at_cmd->cmd)
-        g_free(at_cmd->cmd);
-    if (at_cmd->subcmd)
-        g_free(at_cmd->subcmd);
-    if (at_cmd->value)
-        g_free(at_cmd->value);
-    if (at_cmd->expected)
-        g_free(at_cmd->expected);
+    g_free(at_cmd->cmd);
+    g_free(at_cmd->subcmd);
+    g_free(at_cmd->value);
+    g_free(at_cmd->expected);
     g_free(at_cmd);
     manager->at_cmds = g_list_remove(manager->at_cmds, at_cmd);
 
@@ -142,8 +138,7 @@ static void process_at_result(struct EG25Manager *manager, char *response)
         return;
 
     if (at_cmd->expected && !strstr(response, at_cmd->expected)) {
-        if (at_cmd->value)
-            g_free(at_cmd->value);
+        g_free(at_cmd->value);
         at_cmd->value = at_cmd->expected;
         at_cmd->expected = NULL;
         g_message("Got a different result than expected, changing value...");
-- 
2.31.1