commit bb5dcc10ceb4a956d322cbd7523d3421e80df2e3 from: Stefan Sperling date: Sun Apr 01 15:28:38 2018 UTC fix open file leaks in previous commit - ecf6e46eb15fefb32da8d87c34db1c6983368cc2 commit + bb5dcc10ceb4a956d322cbd7523d3421e80df2e3 blob - 813bce5919460541ece9d709acdba5d247b1a361 blob + f4be6a468e5dcbe30919264e204784c7d766e578 --- lib/diffreg.c +++ lib/diffreg.c @@ -301,8 +301,10 @@ got_diffreg(int *rval, FILE *f1, FILE *f2, int flags, } if (flags & D_EMPTY1) { f1 = fopen(_PATH_DEVNULL, "r"); - if (f1 == NULL) - return got_error_from_errno(); + if (f1 == NULL) { + err = got_error_from_errno(); + goto closem; + } } else if (f1 == NULL) { args->status |= 2; @@ -311,8 +313,10 @@ got_diffreg(int *rval, FILE *f1, FILE *f2, int flags, if (flags & D_EMPTY2) { f2 = fopen(_PATH_DEVNULL, "r"); - if (f2 == NULL) - return got_error_from_errno(); + if (f2 == NULL) { + err = got_error_from_errno(); + goto closem; + } } else if (f2 == NULL) { args->status |= 2; goto closem;