Skip to content

Commit

Permalink
Fix leaks in stdio-wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Daft-Freak committed Feb 22, 2020
1 parent c10ffe2 commit 2975fac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stdio-wrap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ inline wrap_FILE *wrap_fopen(const char *filename, const char *mode)
ret->getc_buf_len = ret->getc_buf_off = 0;

if(!ret->file.is_open())
{
delete ret;
return nullptr;
}

return ret;
}

inline int wrap_fclose(wrap_FILE *file)
{
file->file.close();
delete file;
return 0;
}

Expand Down

0 comments on commit 2975fac

Please sign in to comment.