virtio: Fix memory leak reported by Coverity
PATCH 1/1 virtio: Fix memory leak reported by Coverity
Signed-off-by Stefan Weil <[email protected]>
--- hw/9pfs/virtio-9p-local.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/9pfs/virtio-9p-local.c +2 -5
@@ -488,7 +488,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,int err =-1 ;int serrno =0 ;V9fsString fullname; -char *buffer; +char *buffer =NULL ;v9fs_string_init (&fullname);v9fs_string_sprintf (&fullname,"%s/%s" , dir_path->data, name);
@@ -499,7 +499,6 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, buffer =rpath (fs_ctx, path); err =mknod (buffer,SM_LOCAL_MODE_BITS |S_IFREG ,0 );if (err ==-1 ) { -g_free (buffer); goto out; } err =local_set_xattr (buffer, credp);
@@ -512,7 +511,6 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, buffer =rpath (fs_ctx, path); err =mknod (buffer,SM_LOCAL_MODE_BITS |S_IFREG ,0 );if (err ==-1 ) { -g_free (buffer); goto out; } err =local_set_mapped_file_attr (fs_ctx, path, credp);
@@ -525,7 +523,6 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, buffer =rpath (fs_ctx, path); err =mknod (buffer, credp->fc_mode, credp->fc_rdev);if (err ==-1 ) { -g_free (buffer); goto out; } err =local_post_create_passthrough (fs_ctx, path, credp);
@@ -539,8 +536,8 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, err_end:remove (buffer); errno = serrno; -g_free (buffer); out: +g_free (buffer);v9fs_string_free (&fullname);return err; }
Signature · 1 line
1.7.10.4
Am 14.03.2015 um 11:31 schrieb Stefan Weil:
hw/9pfs/virtio-9p-local.c
Quoted 7 lines
Signed-off-by Stefan Weil <[email protected]>--- hw/9pfs/virtio-9p-local.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)hw/9pfs/virtio-9p-local.c +0
-0
This patch is superseded by a new one which fixes four similar leaks instead of only one.
Regards
Stefan