Skip to content

Commit

Permalink
fix bug: stale file pointer causes segfault on exit (invalidate after…
Browse files Browse the repository at this point in the history
… close)
  • Loading branch information
klheadley committed Mar 19, 2024
1 parent 9a4fb1c commit 4f05db8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mbtrn/utils/emserpub.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ static void app_ctx_destroy(app_ctx_t **pself)
if(self->fp != NULL)
fclose(self->fp);
close(self->fd);
free(self);
}
free(self);
*pself = NULL;
}
}
Expand Down Expand Up @@ -680,8 +680,10 @@ int main(int argc, char **argv)
}

// close file, get next
if(ctx->fp != NULL)
if(ctx->fp != NULL){
fclose(ctx->fp);
ctx->fp = NULL;
}

path = (char *)mlist_next(cfg->file_paths);
}
Expand Down

0 comments on commit 4f05db8

Please sign in to comment.