diff options
| author | mayeut <mayeut@users.noreply.github.com> | 2015-10-17 01:30:23 +0200 |
|---|---|---|
| committer | mayeut <mayeut@users.noreply.github.com> | 2015-10-17 01:30:23 +0200 |
| commit | 83249c318fa9a133cb992973f84e15d3ba3182e0 (patch) | |
| tree | 9ab0a33ee1819fdf5fe9dc85dcae3200ba55aa7f /src/lib/openjp2/tcd.c | |
| parent | dd81b5892d5d0709ab981c9311adca81a7a4cd52 (diff) | |
Fixed crash on encoding
Update #624
Update #625
Diffstat (limited to 'src/lib/openjp2/tcd.c')
| -rw-r--r-- | src/lib/openjp2/tcd.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/openjp2/tcd.c b/src/lib/openjp2/tcd.c index a5a5d272..5e20a7a0 100644 --- a/src/lib/openjp2/tcd.c +++ b/src/lib/openjp2/tcd.c @@ -635,18 +635,15 @@ OPJ_BOOL opj_alloc_tile_component_data(opj_tcd_tilecomp_t *l_tilec) l_tilec->ownsData = OPJ_TRUE; } else if (l_tilec->data_size_needed > l_tilec->data_size) { - OPJ_INT32 * new_data = (OPJ_INT32 *) opj_aligned_realloc(l_tilec->data, l_tilec->data_size_needed); - /* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to handle tile datan"); */ - /* fprintf(stderr, "Not enough memory to handle tile data"); */ - if (! new_data) { - opj_aligned_free(l_tilec->data); - l_tilec->data = NULL; + /* We don't need to keep old data */ + opj_aligned_free(l_tilec->data); + l_tilec->data = (OPJ_INT32 *) opj_aligned_malloc(l_tilec->data_size_needed); + if (! l_tilec->data ) { l_tilec->data_size = 0; l_tilec->data_size_needed = 0; l_tilec->ownsData = OPJ_FALSE; return OPJ_FALSE; } - l_tilec->data = new_data; /*fprintf(stderr, "tReallocate data of tilec (int): from %d to %d x OPJ_UINT32n", l_tilec->data_size, l_data_size);*/ l_tilec->data_size = l_tilec->data_size_needed; l_tilec->ownsData = OPJ_TRUE; @@ -1521,7 +1518,7 @@ static void opj_tcd_free_tile(opj_tcd_t *p_tcd) } if (l_tile_comp->ownsData && l_tile_comp->data) { - opj_free(l_tile_comp->data); + opj_aligned_free(l_tile_comp->data); l_tile_comp->data = 00; l_tile_comp->ownsData = 0; l_tile_comp->data_size = 0; |
