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). --- server/tests/Makefile.am | 2 ++ server/tests/test_display_streaming.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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++) { -- 1.8.4.2 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel