Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Fix all memory leaks in test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
thkukuk committed Mar 23, 2023
1 parent 2995a05 commit 3a9f2c2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/tst-pam_lastlog2-output.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,12 @@ main(void)
return 1;
}

if (output)
free (output);
if (tty)
free (tty);
if (rhost)
free (rhost);

return 0;
}
7 changes: 7 additions & 0 deletions tests/tst-remove-entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,12 @@ main(void)
return 1;
}

if (error)
free (error);
if (tty)
free (tty);
if (rhost)
free (rhost);

return 0;
}
11 changes: 11 additions & 0 deletions tests/tst-rename-user.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ main(void)
return 1;
}

if (error)
{
free (error);
error = NULL;
}

if (ll2_read_entry (db_path, newname, &ll_time, &tty, &rhost, &error) != 0)
{
if (error)
Expand All @@ -99,5 +105,10 @@ main(void)
fprintf (stderr, "New entry data does not match old entry data!\n");
}

if (tty)
free (tty);
if (rhost)
free (rhost);

return 0;
}
6 changes: 6 additions & 0 deletions tests/tst-write-read-user.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ test_args (const char *db_path, const char *user, int64_t ll_time,
return 1;
}

if (res_tty)
free (res_tty);

if (res_rhost)
free (res_rhost);

return 0;
}

Expand Down

0 comments on commit 3a9f2c2

Please sign in to comment.