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.
This commit is contained in:
Dylan Van Assche
2021-05-12 16:41:48 +02:00
parent f2593b62b1
commit 9c4a934a51

View File

@@ -114,14 +114,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);
@@ -152,8 +148,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...");