From c417958a42affedb8682391716d93516ceb2f1e6 Mon Sep 17 00:00:00 2001 From: Steven Smith Date: Sat, 4 Jun 2016 20:10:43 -0700 Subject: [PATCH] Fix two minor issues. --- source/stb_image/stb_image.h | 2 +- source/ui/kbd.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/stb_image/stb_image.h b/source/stb_image/stb_image.h index c1bb3e3..bbe72f0 100644 --- a/source/stb_image/stb_image.h +++ b/source/stb_image/stb_image.h @@ -1575,7 +1575,7 @@ static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h) // magnitude code followed by receive_extend code int k = ((i << len) & ((1 << FAST_BITS) - 1)) >> (FAST_BITS - magbits); int m = 1 << (magbits - 1); - if (k < m) k += (-1 << magbits) + 1; + if (k < m) k += (0xFFFFFFFF << magbits) + 1; // if the result is small enough, we can fit it in fast_ac table if (k >= -128 && k <= 127) fast_ac[i] = (stbi__int16) ((k << 8) + (run << 4) + (len + magbits)); diff --git a/source/ui/kbd.c b/source/ui/kbd.c index 4717bbe..02bdfdd 100644 --- a/source/ui/kbd.c +++ b/source/ui/kbd.c @@ -366,6 +366,8 @@ void kbd_display(const char* name, const char* initialInput, void* data, void (* ui_view* view = (ui_view*) calloc(1, sizeof(ui_view)); if(view == NULL) { error_display(NULL, NULL, NULL, "Failed to allocate UI view."); + + free(kbdData); return; }