mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 07:12:08 +02:00
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:
15
src/at.c
15
src/at.c
@@ -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...");
|
||||
|
Reference in New Issue
Block a user