Skip to content

Commit

Permalink
bb11557 - freeing opts on exit after failed initgroups check
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickey Sola committed Jun 13, 2016
1 parent f5bc94c commit 17d1e36
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions clamav-milter/clamav-milter.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,13 @@ int main(int argc, char **argv) {
#ifdef HAVE_INITGROUPS
if(initgroups(user->pw_name, user->pw_gid)) {
fprintf(stderr, "ERROR: initgroups() failed.\n");
optfree(opts);
return 1;
}
#elif HAVE_SETGROUPS
if(setgroups(1, &user->pw_gid)) {
fprintf(stderr, "ERROR: setgroups() failed.\n");
optfree(opts);
return 1;
}
#endif
Expand Down
4 changes: 3 additions & 1 deletion clamd/clamd.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,14 @@ int main(int argc, char **argv)
#ifdef HAVE_INITGROUPS
if(initgroups(user->pw_name, user->pw_gid)) {
fprintf(stderr, "ERROR: initgroups() failed.\n");
optfree(opts);
return 1;
}
#elif HAVE_SETGROUPS
if(setgroups(1, &user->pw_gid)) {
fprintf(stderr, "ERROR: setgroups() failed.\n");
return 1;
optfree(opts);
return 1;
}
#endif

Expand Down
2 changes: 2 additions & 0 deletions freshclam/freshclam.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,13 @@ main (int argc, char **argv)
#ifdef HAVE_INITGROUPS
if (initgroups(dbowner, user->pw_gid)) {
logg ("^initgroups() failed.\n");
optfree (opts);
return FCE_USERORGROUP;
}
#elif HAVE_SETGROUPS
if (setgroups(1, &user->pw_gid)) {
logg ("^setgroups() failed.\n");
optfree (opts);
return FCE_USERORGROUP;
}
#endif
Expand Down

0 comments on commit 17d1e36

Please sign in to comment.