summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/dwt.c
diff options
context:
space:
mode:
authormayeut <mayeut@users.noreply.github.com>2015-10-17 02:55:09 +0200
committermayeut <mayeut@users.noreply.github.com>2015-10-17 02:55:09 +0200
commit8034ffde8b108957aeff801c30b1a4c31e147e55 (patch)
tree0de1362dce9993be1f4924dbcf81d3df275e67c7 /src/lib/openjp2/dwt.c
parentb3a15954f6bad45b8f2e8ae8f1d97fe40f5d5dc8 (diff)
Fix inconsistent behavior of malloc(0)
Update #635 Update #625
Diffstat (limited to 'src/lib/openjp2/dwt.c')
-rw-r--r--src/lib/openjp2/dwt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/openjp2/dwt.c b/src/lib/openjp2/dwt.c
index 4ad99ed9..41dca2fe 100644
--- a/src/lib/openjp2/dwt.c
+++ b/src/lib/openjp2/dwt.c
@@ -567,9 +567,11 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres
OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 - tr->y0); /* height of the resolution level computed */
OPJ_UINT32 w = (OPJ_UINT32)(tilec->x1 - tilec->x0);
-
- h.mem = (OPJ_INT32*)
- opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32));
+
+ if (numres == 1U) {
+ return OPJ_TRUE;
+ }
+ h.mem = (OPJ_INT32*)opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32));
if (! h.mem){
/* FIXME event manager error callback */
return OPJ_FALSE;