From 98399ed51045871f8d73599322b6947d6b2b80d0 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 10 Aug 2015 13:51:40 +0200 Subject: Update lzo to 2.09 --- main/lzo/src/lzo_swd.ch | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'main/lzo/src/lzo_swd.ch') diff --git a/main/lzo/src/lzo_swd.ch b/main/lzo/src/lzo_swd.ch index 566aca45..4a73a6b4 100644 --- a/main/lzo/src/lzo_swd.ch +++ b/main/lzo/src/lzo_swd.ch @@ -2,7 +2,7 @@ This file is part of the LZO real-time data compression library. - Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer All Rights Reserved. The LZO library is free software; you can redistribute it and/or @@ -237,20 +237,33 @@ void swd_insertdict(lzo_swd_p s, lzo_uint node, lzo_uint len) // ************************************************************************/ +static void swd_exit(lzo_swd_p s); + static int swd_init(lzo_swd_p s, const lzo_bytep dict, lzo_uint dict_len) { #if defined(__LZO_CHECKER) + unsigned r = 1; s->b = (lzo_bytep) malloc(SWD_N + SWD_F + SWD_F); s->head3 = (swd_uintp) malloc(sizeof(swd_uint) * SWD_HSIZE); s->succ3 = (swd_uintp) malloc(sizeof(swd_uint) * (SWD_N + SWD_F)); s->best3 = (swd_uintp) malloc(sizeof(swd_uint) * (SWD_N + SWD_F)); s->llen3 = (swd_uintp) malloc(sizeof(swd_uint) * SWD_HSIZE); + r &= s->b != NULL; + r &= s->head3 != NULL; + r &= s->succ3 != NULL; + r &= s->best3 != NULL; + r &= s->llen3 != NULL; #ifdef HEAD2 IF_HEAD2(s) { s->head2 = (swd_uintp) malloc(sizeof(swd_uint) * 65536L); + r &= s->head2 != NULL; } #endif + if (r != 1) { + swd_exit(s); + return LZO_E_OUT_OF_MEMORY; + } #endif s->m_len = 0; @@ -683,7 +696,4 @@ void swd_findbest(lzo_swd_p s) #undef s_get_head3 -/* -vi:ts=4:et -*/ - +/* vim:set ts=4 sw=4 et: */ -- cgit v1.2.3