summaryrefslogtreecommitdiff
path: root/main/lzo/src/lzo_swd.ch
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2015-08-10 13:51:40 +0200
committerArne Schwabe <arne@rfc2549.org>2015-08-10 13:51:40 +0200
commit98399ed51045871f8d73599322b6947d6b2b80d0 (patch)
tree28eb352fc1fd89f9c0969cfe0e7c384dee8b17df /main/lzo/src/lzo_swd.ch
parente6af88b346e9eb5be462429bf9786e7e89ce0e0d (diff)
Update lzo to 2.09
Diffstat (limited to 'main/lzo/src/lzo_swd.ch')
-rw-r--r--main/lzo/src/lzo_swd.ch20
1 files changed, 15 insertions, 5 deletions
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: */