Skip to content

Commit

Permalink
Fix#2222 Improved bytearray handling (#2432)
Browse files Browse the repository at this point in the history
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch

## Motivation (required)

What existing problem does the pull request solve?

It solves #2222

If you have added code that should be tested, add tests.

This code doesn't needs to be tested.

## Next Steps

Sign the [CLA][2], if you haven't already.

Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

Make sure all **tests pass** on [Circle CI][4]. PRs that break tests are unlikely to be merged.

For more info, see the [Contributing guide][4].

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: http://circleci.com/gh/facebook/fresco
[4]: https://github.com/facebook/fresco/blob/master/CONTRIBUTING.md
Pull Request resolved: #2432

Reviewed By: defHLT

Differential Revision: D18475182

Pulled By: oprisnik

fbshipit-source-id: dfaa773154551d1b699dd41a215b0d3334852487
  • Loading branch information
iadeelzafar authored and facebook-github-bot committed Nov 27, 2019
1 parent 8b3716c commit e924838
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -133,6 +133,11 @@ static void osInitDestination(j_compress_ptr cinfo) {

// allocate java byte array
dest->javaBuffer = env->NewByteArray(kStreamBufferSize);
if (dest->javaBuffer == NULL) {
jpegSafeThrow(
(j_common_ptr) cinfo,
"Failed to allocate memory for java byte buffer.");
}
jpegJumpOnException((j_common_ptr) cinfo);

// allocate the output buffer --- it will be released when done with image
Expand All @@ -143,7 +148,7 @@ static void osInitDestination(j_compress_ptr cinfo) {
if (dest->buffer == NULL) {
jpegSafeThrow(
(j_common_ptr) cinfo,
"Failed to allcoate memory for byte buffer.");
"Failed to allocate memory for byte buffer.");
}
dest->public_fields.next_output_byte = dest->buffer;
dest->public_fields.free_in_buffer = kStreamBufferSize;
Expand Down

0 comments on commit e924838

Please sign in to comment.