[Spice-commits] 2 commits - server/tests
Christophe Fergau
teuf at kemper.freedesktop.org
Tue Jan 7 04:59:20 PST 2014
server/tests/Makefile.am | 2 ++
server/tests/test_display_base.c | 1 -
server/tests/test_display_streaming.c | 8 ++++++--
server/tests/test_playback.c | 2 --
4 files changed, 8 insertions(+), 5 deletions(-)
New commits:
commit 7d9018d441cbb91207157b787c510da03101ef98
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Jan 2 18:07:16 2014 +0100
tests: Avoid malloc failures
test-display-streaming is calling malloc() without checking its return
value. Coverity warns about this. This commit switches to g_malloc() to
sidestep this warning (g_malloc() never returns NULL but aborts instead).
diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
index f4ae661..e2201cc 100644
--- a/server/tests/Makefile.am
+++ b/server/tests/Makefile.am
@@ -6,6 +6,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/server \
-I$(top_srcdir)/server/tests \
$(COMMON_CFLAGS) \
+ $(GLIB2_CFLAGS) \
$(SMARTCARD_CFLAGS) \
$(SPICE_NONPKGCONFIG_CFLAGS) \
$(NULL)
@@ -17,6 +18,7 @@ endif
LDADD = \
$(top_builddir)/spice-common/common/libspice-common.la \
$(top_builddir)/server/libspice-server.la \
+ $(GLIB2_LIBS) \
$(NULL)
COMMON_BASE = \
diff --git a/server/tests/test_display_streaming.c b/server/tests/test_display_streaming.c
index b66d870..01c7e7a 100644
--- a/server/tests/test_display_streaming.c
+++ b/server/tests/test_display_streaming.c
@@ -5,12 +5,16 @@
*/
#include <config.h>
+
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
+
+#include <glib.h>
+
#include "test_display_base.h"
static int sized;
@@ -29,7 +33,7 @@ static void create_overlay(Command *command , int width, int height)
cmd->bbox.bottom = height;
cmd->num_clip_rects = 0;
- cmd->bitmap = malloc(width * height * 4 );
+ cmd->bitmap = g_malloc(width * height * 4 );
dst = (uint32_t *)cmd->bitmap;
for (int i = 0; i < width * height; i++, dst++) {
*dst = 0x8B008B;
@@ -100,7 +104,7 @@ static void create_clipped_frame(Test *test, Command *command, int clipping_fact
end_line += 50;
}
- cmd->bitmap = malloc(width*height*4);
+ cmd->bitmap = g_malloc(width*height*4);
memset(cmd->bitmap, 0xff, width*height*4);
dst = (uint32_t *)(cmd->bitmap + cur_line*width*4);
for (cur_line; cur_line < end_line; cur_line++) {
commit 3ac428b4b7f094ac091b2b8c39b47f90a74b9769
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Jan 2 18:06:08 2014 +0100
tests: Remove unused variables
coverity spotted some variables that were declared but not used in
server/tests
diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index ccdd2f2..03798ac 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -672,7 +672,6 @@ static void cursor_init()
static int get_cursor_command(QXLInstance *qin, struct QXLCommandExt *ext)
{
Test *test = SPICE_CONTAINEROF(qin, Test, qxl_instance);
- static int color = 0;
static int set = 1;
static int x = 0, y = 0;
QXLCursorCmd *cursor_cmd;
diff --git a/server/tests/test_playback.c b/server/tests/test_playback.c
index ed1b766..cc7b120 100644
--- a/server/tests/test_playback.c
+++ b/server/tests/test_playback.c
@@ -53,8 +53,6 @@ void playback_timer_cb(void *opaque)
int i;
struct timeval cur;
uint64_t cur_usec;
- uint32_t *test_frame;
- uint32_t test_num_samples;
get_frame();
if (!frame) {
More information about the Spice-commits
mailing list