Skip to content

Commit

Permalink
Minor alloc cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
ckolivas committed May 16, 2018
1 parent 38386bd commit 3b61d97
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lrzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,8 @@ bool compress_file(rzip_control *control)
bool initialise_control(rzip_control *control)
{
time_t now_t, tdiff;
char *eptr; /* for environment */
char localeptr[] = "./", *eptr; /* for environment */
size_t len;

memset(control, 0, sizeof(rzip_control));
control->msgout = stderr;
Expand Down Expand Up @@ -1346,13 +1347,9 @@ bool initialise_control(rzip_control *control)
eptr = getenv("TEMPDIR");
if (!eptr)
eptr = getenv("TEMP");
if (!eptr) {
eptr = malloc(3);
if ( eptr == NULL )
fatal_return(("Failed to allocate for eptr\n"), false);
strcpy(eptr,"./");
}
size_t len = strlen(eptr);
if (!eptr)
eptr = localeptr;
len = strlen(eptr);

control->tmpdir = malloc(len + 2);
if (control->tmpdir == NULL)
Expand Down

0 comments on commit 3b61d97

Please sign in to comment.