diff --git a/clientserver.c b/clientserver.c index cc59663a..dbde116c 100644 --- a/clientserver.c +++ b/clientserver.c @@ -270,11 +270,14 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char FILE *f = fopen(early_input_file, "rb"); if (!f || do_fstat(fileno(f), &st) < 0) { rsyserr(FERROR, errno, "failed to open %s", early_input_file); + if (f) + fclose(f); return -1; } early_input_len = st.st_size; if (early_input_len > (int)sizeof line) { rprintf(FERROR, "%s is > %d bytes.\n", early_input_file, (int)sizeof line); + fclose(f); return -1; } if (early_input_len > 0) { @@ -283,6 +286,7 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char int len; if (feof(f)) { rprintf(FERROR, "Early EOF in %s\n", early_input_file); + fclose(f); return -1; } len = fread(line, 1, early_input_len, f); diff --git a/getgroups.c b/getgroups.c index 8a37ed0b..6b83d452 100644 --- a/getgroups.c +++ b/getgroups.c @@ -57,5 +57,6 @@ printf("%lu", (unsigned long)gid); printf("\n"); + free(list); return 0; }