diff --git a/src/at.c b/src/at.c index a206414..5d90158 100644 --- a/src/at.c +++ b/src/at.c @@ -56,14 +56,14 @@ static void at_free_command(gpointer cmd, gpointer data) if (!at_cmd) return; + if (manager && manager->at_cmds) + manager->at_cmds = g_list_remove(manager->at_cmds, at_cmd); + g_free(at_cmd->cmd); g_free(at_cmd->subcmd); g_free(at_cmd->value); g_free(at_cmd->expected); g_free(at_cmd); - - if (manager && manager->at_cmds) - manager->at_cmds = g_list_remove(manager->at_cmds, at_cmd); } gboolean at_send_command(struct EG25Manager *manager) diff --git a/src/gnss.c b/src/gnss.c index 06630c2..ae2fd11 100644 --- a/src/gnss.c +++ b/src/gnss.c @@ -246,18 +246,19 @@ static void fetch_assistance_data(struct EG25Manager *manager) g_message("Fetching GNSS assistance data from %s was successful", url); - fflush(tmp_file); - curl_easy_cleanup(curl); - /* Go to the next step */ manager->gnss_assistance_step++; gnss_step(manager); - return; + + goto cleanup; bail: + manager->gnss_assistance_step = EG25_GNSS_STEP_LAST; +cleanup: + fflush(tmp_file); + fclose(tmp_file); if (curl != NULL) curl_easy_cleanup(curl); - manager->gnss_assistance_step = EG25_GNSS_STEP_LAST; } /******************************************************************************/ diff --git a/src/gpio.c b/src/gpio.c index 618c757..d8c4a76 100644 --- a/src/gpio.c +++ b/src/gpio.c @@ -258,7 +258,7 @@ int gpio_all_chip_paths(char ***paths_ptr) struct gpiod_chip *gpio_chip_open_by_label(const char *label) { int num_chips, i; - char **paths; + char **paths = NULL; const char *clabel; struct gpiod_chip *chip; struct gpiod_chip_info *cinfo; diff --git a/src/suspend.c b/src/suspend.c index b54bad7..aefb636 100644 --- a/src/suspend.c +++ b/src/suspend.c @@ -282,6 +282,7 @@ void suspend_init(struct EG25Manager *manager, toml_table_t *config[]) manager->modem_recovery_timeout = 9; g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, + // NOLINTNEXTLINE Flags combination is valid even if not matching an enum entry G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL, diff --git a/src/toml.c b/src/toml.c index 62a7de6..6438b85 100644 --- a/src/toml.c +++ b/src/toml.c @@ -396,7 +396,11 @@ static int e_keyexists(context_t *ctx, int lineno) static void *expand(void *p, int sz, int newsz) { - void *s = MALLOC(newsz); + void *s; + if (!p) + return 0; + + s = MALLOC(newsz); if (!s) return 0; @@ -1499,7 +1503,6 @@ toml_table_t *toml_parse_file(FILE *fp, char *errbuf, int errbufsz) return 0; } buf = x; - bufsz = xsz; } buf[off] = 0;