[spice-server PATCH 2/4] dcc_gl_scanout_item_new: allocate item when needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prevents a leak on early return.

Found by coverity.

Signed-off-by: Uri Lublin <uril@xxxxxxxxxx>
---
 server/dcc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/dcc.c b/server/dcc.c
index 1a7aac9..cdd888b 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -571,7 +571,7 @@ static RedSurfaceDestroyItem *red_surface_destroy_item_new(RedChannel *channel,
 
 RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
 {
-    RedGlScanoutUnixItem *item = spice_new(RedGlScanoutUnixItem, 1);
+    RedGlScanoutUnixItem *item;
 
     /* FIXME: on !unix peer, start streaming with a video codec */
     if (!reds_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
@@ -581,6 +581,7 @@ RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
         return NULL;
     }
 
+    item = spice_new(RedGlScanoutUnixItem, 1);
     red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_GL_SCANOUT);
 
     return &item->base;
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]