server: Avoid potential double free (Coverity).

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-10-16 15:28:38 +02:00
parent 625293289c
commit af238f5653
1 changed files with 1 additions and 1 deletions

View File

@ -507,13 +507,13 @@ static int build_shared_mapping( struct mapping *mapping, int fd,
} }
if (pwrite( shared_fd, buffer, file_size, write_pos ) != file_size) goto error; if (pwrite( shared_fd, buffer, file_size, write_pos ) != file_size) goto error;
} }
free( buffer );
if (!(shared = alloc_object( &shared_map_ops ))) goto error; if (!(shared = alloc_object( &shared_map_ops ))) goto error;
shared->fd = (struct fd *)grab_object( mapping->fd ); shared->fd = (struct fd *)grab_object( mapping->fd );
shared->file = file; shared->file = file;
list_add_head( &shared_map_list, &shared->entry ); list_add_head( &shared_map_list, &shared->entry );
mapping->shared = shared; mapping->shared = shared;
free( buffer );
return 1; return 1;
error: error: