diff options
| author | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-11-14 08:29:12 +0000 |
|---|---|---|
| committer | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-11-14 08:29:12 +0000 |
| commit | 61a15672bb980744297909e6dfe97b23c2430aea (patch) | |
| tree | db1ef7a27a48ade5ad81705dce2ce763c65f46a2 /libopenjpeg | |
| parent | dbeebe72b9d35f6ff807c21c7f217b569fa894f6 (diff) | |
Patch by Callum Lerwick. Instead of reinventing realloc, j2k_read_sod now just uses opj_realloc in j2k.c
Diffstat (limited to 'libopenjpeg')
| -rw-r--r-- | libopenjpeg/j2k.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index dfa8286c..f563b2a6 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -1509,11 +1509,8 @@ static void j2k_read_sod(opj_j2k_t *j2k) { truncate = 1; /* Case of a truncate codestream */ } - data = (unsigned char *) opj_malloc((j2k->tile_len[curtileno] + len) * sizeof(unsigned char)); - - for (i = 0; i < j2k->tile_len[curtileno]; i++) { - data[i] = j2k->tile_data[curtileno][i]; - } + data = j2k->tile_data[curtileno]; + data = (unsigned char*) opj_realloc(data, (j2k->tile_len[curtileno] + len) * sizeof(unsigned char)); data_ptr = data + j2k->tile_len[curtileno]; for (i = 0; i < len; i++) { @@ -1521,7 +1518,6 @@ static void j2k_read_sod(opj_j2k_t *j2k) { } j2k->tile_len[curtileno] += len; - opj_free(j2k->tile_data[curtileno]); j2k->tile_data[curtileno] = data; if (!truncate) { |
