~martijnbraam/public-inbox

Megapixels: Fix an off-by-one error and a memory leak v1 PROPOSED

David Hedberg: 1
 Fix an off-by-one error and a memory leak

 1 files changed, 2 insertions(+), 2 deletions(-)
#622455 alpine.yml success
#622456 arch.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~martijnbraam/public-inbox/patches/26259/mbox | git am -3
Learn more about email & git

[PATCH Megapixels] Fix an off-by-one error and a memory leak Export this patch

The off-by-one would previously trigger an assert in musl when
freeing the image data.
---
 src/zbar_pipeline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/zbar_pipeline.c b/src/zbar_pipeline.c
index 0fa5223..87f24ff 100644
--- a/src/zbar_pipeline.c
+++ b/src/zbar_pipeline.c
@@ -176,7 +176,7 @@ process_image(MPPipeline *pipeline, MPZBarImage **_image)
	size_t i = 0;
	for (int y = 0; y < image->height; y += 2) {
		for (int x = 0; x < image->width; x += 2) {
			data[++i] = image->data[x + image->width * y];
			data[i++] = image->data[x + image->width * y];
		}
	}

@@ -184,7 +184,7 @@ process_image(MPPipeline *pipeline, MPZBarImage **_image)
	zbar_image_t *zbar_image = zbar_image_create();
	zbar_image_set_format(zbar_image, zbar_fourcc('Y', '8', '0', '0'));
	zbar_image_set_size(zbar_image, width, height);
	zbar_image_set_data(zbar_image, data, width * height * sizeof(uint8_t), NULL);
	zbar_image_set_data(zbar_image, data, width * height * sizeof(uint8_t), zbar_image_free_data);

	int res = zbar_scan_image(scanner, zbar_image);
	assert(res >= 0);
-- 
2.33.1
megapixels/patches: SUCCESS in 1m14s

[Fix an off-by-one error and a memory leak][0] from [David Hedberg][1]

[0]: https://lists.sr.ht/~martijnbraam/public-inbox/patches/26259
[1]: mailto:david.hedberg@gmail.com

✓ #622456 SUCCESS megapixels/patches/arch.yml   https://builds.sr.ht/~martijnbraam/job/622456
✓ #622455 SUCCESS megapixels/patches/alpine.yml https://builds.sr.ht/~martijnbraam/job/622455