aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/jpeg/bgr24.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib/jpeg/bgr24.c')
-rw-r--r--com32/lib/jpeg/bgr24.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/com32/lib/jpeg/bgr24.c b/com32/lib/jpeg/bgr24.c
index d72e29b2..855b855f 100644
--- a/com32/lib/jpeg/bgr24.c
+++ b/com32/lib/jpeg/bgr24.c
@@ -347,12 +347,12 @@ static int initialize_bgr24(struct jdec_private *priv,
unsigned int *bytes_per_blocklines,
unsigned int *bytes_per_mcu)
{
- if (priv->components[0] == NULL)
- priv->components[0] = (uint8_t *)malloc(priv->width * priv->height * 3);
if (!priv->bytes_per_row[0])
priv->bytes_per_row[0] = priv->width * 3;
+ if (!priv->components[0])
+ priv->components[0] = malloc(priv->height * priv->bytes_per_row[0]);
- bytes_per_blocklines[0] = priv->bytes_per_row[0];
+ bytes_per_blocklines[0] = priv->bytes_per_row[0] << 3;
bytes_per_mcu[0] = 3*8;
return !priv->components[0];