aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/jpeg/grey.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib/jpeg/grey.c')
-rw-r--r--com32/lib/jpeg/grey.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/com32/lib/jpeg/grey.c b/com32/lib/jpeg/grey.c
index 2f114744..6710ede6 100644
--- a/com32/lib/jpeg/grey.c
+++ b/com32/lib/jpeg/grey.c
@@ -91,12 +91,12 @@ static int initialize_grey(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);
if (!priv->bytes_per_row[0])
priv->bytes_per_row[0] = priv->width;
+ 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] = 8;
return !priv->components[0];