recovery: free strings returned by uboot_getenv()

The function uboot_getenv() is a wrapper over libuboot_get_env() and
requires that the returned strings are freed when no longer in use.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7645
This commit is contained in:
Hector Palacios 2021-08-25 12:30:44 +02:00
parent f806979c84
commit 27ce7a4f20
1 changed files with 4 additions and 0 deletions

View File

@ -96,6 +96,7 @@ static bool is_dualboot_enabled(void)
if (!strcmp(var, "yes"))
ret = true;
free(var);
return ret;
}
@ -148,6 +149,7 @@ static int append_recovery_command(const char *value)
free(new_recovery_cmd);
err:
free(old_recovery_cmd);
return ret ? -1 : 0;
}
@ -522,6 +524,7 @@ static int parse_nand_partition_info(char **parts, char **encrypted, unsigned ch
err:
if (tmp)
free(tmp);
free(var);
/* NULL-terminate the arrays */
parts[i] = NULL;
@ -588,6 +591,7 @@ err:
pclose(fp);
if (tmp)
free(tmp);
free(var);
/* NULL-terminate the parts array */
parts[i] = NULL;