[PATCH spice-server] reds: Fix use-after-free

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

 



video_codecs can be freed so use it before.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/reds.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 817fdd423..78bbe5a0f 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3851,6 +3851,10 @@ static int reds_set_video_codecs_from_string(RedsState *reds, const char *codecs
         codecs = c;
     }
 
+    if (installed) {
+        *installed = video_codecs->len;
+    }
+
     if (video_codecs->len == 0) {
         spice_warning("Failed to set video codecs, input string: '%s'", codecs);
         g_array_unref(video_codecs);
@@ -3860,10 +3864,6 @@ static int reds_set_video_codecs_from_string(RedsState *reds, const char *codecs
 
     g_free(codecs_copy);
 
-    if (installed) {
-        *installed = video_codecs->len;
-    }
-
     return invalid_codecs;
 }
 
-- 
2.20.1

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




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