malloc() mem those persist through program runtime

At exit, the OS should reclaim all the memory, so no explicit free() required.
This commit is contained in:
Arun Prakash Jana 2021-11-05 07:50:48 +05:30
parent 07a47db8fe
commit b84ad2d552
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 2 additions and 4 deletions

View File

@ -6560,9 +6560,7 @@ static bool cdprep(char *lastdir, char *lastname, char *path, char *newpath)
static bool browse(char *ipath, const char *session, int pkey)
{
char newpath[PATH_MAX] __attribute__ ((aligned)),
rundir[PATH_MAX] __attribute__ ((aligned)),
runfile[NAME_MAX + 1] __attribute__ ((aligned));
char *newpath = malloc(PATH_MAX), *rundir = malloc(PATH_MAX), *runfile = malloc(NAME_MAX + 1);
char *path, *lastdir, *lastname, *dir, *tmp;
pEntry pent;
enum action sel;
@ -6722,7 +6720,7 @@ nochange:
/* If STDIN is no longer a tty (closed) we should exit */
if (!isatty(STDIN_FILENO) && !g_state.picker)
return EXIT_FAILURE;
return EXIT_FAILURE; // NOLINT
sel = nextsel(presel);
if (presel)