summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/registry/regfio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c
index 92077aa847..3740ff0ee4 100644
--- a/source3/registry/regfio.c
+++ b/source3/registry/regfio.c
@@ -1234,7 +1234,7 @@ static void regfio_mem_free( REGF_FILE *file )
/* cleanup for a file opened for write */
- if ( file->open_flags & (O_WRONLY|O_RDWR) ) {
+ if ((file->fd != -1) && (file->open_flags & (O_WRONLY|O_RDWR))) {
prs_struct ps;
REGF_SK_REC *sk;