[Spice-commits] 7 commits - common/canvas_base.c common/canvas_utils.c common/lines.c common/log.c common/lz.c common/lz_compress_tmpl.c
Fabiano Fidêncio
fidencio at kemper.freedesktop.org
Mon May 2 06:46:14 UTC 2016
common/canvas_base.c | 1 +
common/canvas_utils.c | 1 +
common/lines.c | 2 +-
common/log.c | 4 ++--
common/lz.c | 1 +
common/lz_compress_tmpl.c | 23 +++++++++--------------
6 files changed, 15 insertions(+), 17 deletions(-)
New commits:
commit 74439e8e6e0b2a7a16f31bc72318471df5bfe87d
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Mon Apr 4 08:50:55 2016 +0200
Use g_getenv() instead of getenv()
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/common/log.c b/common/log.c
index e39eefc..20d4597 100644
--- a/common/log.c
+++ b/common/log.c
@@ -59,7 +59,7 @@ static GLogLevelFlags spice_log_level_to_glib(SpiceLogLevel level)
static void spice_log_set_debug_level(void)
{
if (glib_debug_level == 0) {
- char *debug_str = getenv("SPICE_DEBUG_LEVEL");
+ const char *debug_str = g_getenv("SPICE_DEBUG_LEVEL");
if (debug_str != NULL) {
int debug_level;
char *debug_env;
@@ -96,7 +96,7 @@ static void spice_log_set_debug_level(void)
static void spice_log_set_abort_level(void)
{
if (abort_level == -1) {
- char *abort_str = getenv("SPICE_ABORT_LEVEL");
+ const char *abort_str = g_getenv("SPICE_ABORT_LEVEL");
if (abort_str != NULL) {
GLogLevelFlags glib_abort_level;
commit a8f756eabfa7dfd79f265dd8efb6c9b8b833ac58
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Mon Apr 4 08:40:01 2016 +0200
coverity: remove structurally dead code
The loop (for (;;)) will be executed only once, so, no reason for
keeping it.
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/common/lz_compress_tmpl.c b/common/lz_compress_tmpl.c
index e316c4b..0305278 100644
--- a/common/lz_compress_tmpl.c
+++ b/common/lz_compress_tmpl.c
@@ -323,18 +323,15 @@ match: // RLE or dictionary (both are encoded by distance from ref (-1) a
// TODO: maybe separate a run from the same seg or from different ones in order
// to spare ref < ref_limit and that way we can also perform 8 calls of
// (ref++ != ip++) outside a loop
- for (;;) {
- while ((ip < ip_bound) && (ref < ref_limit)) {
- if (!SAME_PIXEL(*ref, *ip)) {
- ref++;
- ip++;
- break;
- } else {
- ref++;
- ip++;
- }
+ while ((ip < ip_bound) && (ref < ref_limit)) {
+ if (!SAME_PIXEL(*ref, *ip)) {
+ ref++;
+ ip++;
+ break;
+ } else {
+ ref++;
+ ip++;
}
- break;
}
}
commit 83b84428ec9af56fd8a261a03457f6c17b642ee1
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Mon Apr 4 08:24:50 2016 +0200
coverity: remove unused value
len is overwritten in the match label with the value from
"ip - anchor".
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/common/lz_compress_tmpl.c b/common/lz_compress_tmpl.c
index 3162a96..e316c4b 100644
--- a/common/lz_compress_tmpl.c
+++ b/common/lz_compress_tmpl.c
@@ -214,9 +214,7 @@ static void FNAME(compress_seg)(Encoder *encoder, LzImageSegment *seg, PIXEL *fr
ip += 3;
ref = anchor + 2;
ref_limit = (PIXEL *)(seg->lines_end);
-#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32)
- len = 3;
-#endif
+
goto match;
}
}
commit 657e1c5291f1b97c3561f9cf3d15f7ae0d22c68d
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Mon Apr 4 08:16:18 2016 +0200
coverity: avoid division or modulo by zero
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/common/lines.c b/common/lines.c
index 10ca318..e5097c4 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -412,7 +412,7 @@ miStepDash (int dist, /* distance to step */
totallen = 0;
for (i = 0; i < numInDashList; i++)
totallen += pDash[i];
- if (totallen <= dist)
+ if (totallen > 0 && totallen <= dist)
dist = dist % totallen;
while (dist >= pDash[dashIndex]) {
dist -= pDash[dashIndex];
commit 3312a0f70b1cb9d0e8b6bbaaf7028b90daf3fa9c
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Mon Apr 4 07:42:56 2016 +0200
coverity: avoid dereference after null check
All decompress functions used after this check take into account that
encoder->palette is not NULL. So, if we already detected that the
palette is NULL, let's just return early.
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/common/lz.c b/common/lz.c
index d1c4033..2589223 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -647,6 +647,7 @@ void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf)
if (!encoder->palette) {
encoder->usr->error(encoder->usr,
"a palette is missing (for bpp to rgb decoding)\n");
+ return;
}
switch (encoder->type) {
case LZ_IMAGE_TYPE_PLT1_BE:
commit 89b902789bad004e0db51862a34de6e4ef6ed425
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Fri Apr 1 23:16:39 2016 +0200
coverity: avoid resource leak
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 114c1b9..cf36257 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -776,6 +776,7 @@ static inline SpicePalette *canvas_get_localized_palette(CanvasBase *canvas, Spi
case SPICE_SURFACE_FMT_16_565:
default:
spice_warn_if_reached();
+ free(copy);
return NULL;
}
*free_palette = TRUE;
commit bc73df4e473516f25ce2f4b38b8a478f270de3ed
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Fri Apr 1 22:54:51 2016 +0200
coverity: avoid use after free
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/common/canvas_utils.c b/common/canvas_utils.c
index c5813f4..0be761a 100644
--- a/common/canvas_utils.c
+++ b/common/canvas_utils.c
@@ -109,6 +109,7 @@ static inline pixman_image_t *__surface_create_stride(pixman_format_code_t forma
if (surface == NULL) {
free(data);
+ data = NULL;
spice_error("create surface failed, out of memory");
}
More information about the Spice-commits
mailing list