diff options
-rw-r--r-- | source4/ntvfs/posix/pvfs_streams.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source4/ntvfs/posix/pvfs_streams.c b/source4/ntvfs/posix/pvfs_streams.c index 4da95432c1..cacd8c1995 100644 --- a/source4/ntvfs/posix/pvfs_streams.c +++ b/source4/ntvfs/posix/pvfs_streams.c @@ -304,11 +304,15 @@ NTSTATUS pvfs_stream_rename(struct pvfs_state *pvfs, struct pvfs_filename *name, } status = pvfs_streams_save(pvfs, name, fd, streams); - talloc_free(streams); - /* update the in-memory copy of the name of the open file */ - talloc_free(name->stream_name); - name->stream_name = talloc_strdup(name, new_name); + if (NT_STATUS_IS_OK(status)) { + + /* update the in-memory copy of the name of the open file */ + talloc_free(name->stream_name); + name->stream_name = talloc_strdup(name, new_name); + + talloc_free(streams); + } return status; } |