mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Minor alloc cleanup.
This commit is contained in:
parent
38386bd482
commit
3b61d97233
13
lrzip.c
13
lrzip.c
|
|
@ -1303,7 +1303,8 @@ error:
|
||||||
bool initialise_control(rzip_control *control)
|
bool initialise_control(rzip_control *control)
|
||||||
{
|
{
|
||||||
time_t now_t, tdiff;
|
time_t now_t, tdiff;
|
||||||
char *eptr; /* for environment */
|
char localeptr[] = "./", *eptr; /* for environment */
|
||||||
|
size_t len;
|
||||||
|
|
||||||
memset(control, 0, sizeof(rzip_control));
|
memset(control, 0, sizeof(rzip_control));
|
||||||
control->msgout = stderr;
|
control->msgout = stderr;
|
||||||
|
|
@ -1346,13 +1347,9 @@ bool initialise_control(rzip_control *control)
|
||||||
eptr = getenv("TEMPDIR");
|
eptr = getenv("TEMPDIR");
|
||||||
if (!eptr)
|
if (!eptr)
|
||||||
eptr = getenv("TEMP");
|
eptr = getenv("TEMP");
|
||||||
if (!eptr) {
|
if (!eptr)
|
||||||
eptr = malloc(3);
|
eptr = localeptr;
|
||||||
if ( eptr == NULL )
|
len = strlen(eptr);
|
||||||
fatal_return(("Failed to allocate for eptr\n"), false);
|
|
||||||
strcpy(eptr,"./");
|
|
||||||
}
|
|
||||||
size_t len = strlen(eptr);
|
|
||||||
|
|
||||||
control->tmpdir = malloc(len + 2);
|
control->tmpdir = malloc(len + 2);
|
||||||
if (control->tmpdir == NULL)
|
if (control->tmpdir == NULL)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue