mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 15:54:05 +01:00
Fix potential (but impossible with current code) TXTP segfault
This commit is contained in:
parent
613368f72d
commit
3aef648730
@ -151,7 +151,7 @@ VGMSTREAM * init_vgmstream_txtp(STREAMFILE *streamFile) {
|
|||||||
data_l = init_layout_layered(txtp->entry_count);
|
data_l = init_layout_layered(txtp->entry_count);
|
||||||
if (!data_l) goto fail;
|
if (!data_l) goto fail;
|
||||||
|
|
||||||
/* open each segment subfile */
|
/* open each layer subfile */
|
||||||
for (i = 0; i < data_l->layer_count; i++) {
|
for (i = 0; i < data_l->layer_count; i++) {
|
||||||
STREAMFILE* temp_streamFile = open_streamfile_by_filename(streamFile, txtp->entry[i].filename);
|
STREAMFILE* temp_streamFile = open_streamfile_by_filename(streamFile, txtp->entry[i].filename);
|
||||||
if (!temp_streamFile) goto fail;
|
if (!temp_streamFile) goto fail;
|
||||||
@ -192,6 +192,8 @@ VGMSTREAM * init_vgmstream_txtp(STREAMFILE *streamFile) {
|
|||||||
for (i = 0; i < data_s->segment_count; i++) {
|
for (i = 0; i < data_s->segment_count; i++) {
|
||||||
STREAMFILE* temp_streamFile = open_streamfile_by_filename(streamFile, txtp->entry[i].filename);
|
STREAMFILE* temp_streamFile = open_streamfile_by_filename(streamFile, txtp->entry[i].filename);
|
||||||
if (!temp_streamFile) goto fail;
|
if (!temp_streamFile) goto fail;
|
||||||
|
|
||||||
|
/* subsongs ranges also work for files without subsongs (as to repeat the same file), not sure if bug or feature */
|
||||||
temp_streamFile->stream_index = txtp->entry[i].subsong;
|
temp_streamFile->stream_index = txtp->entry[i].subsong;
|
||||||
|
|
||||||
data_s->segments[i] = init_vgmstream_from_STREAMFILE(temp_streamFile);
|
data_s->segments[i] = init_vgmstream_from_STREAMFILE(temp_streamFile);
|
||||||
@ -253,8 +255,10 @@ VGMSTREAM * init_vgmstream_txtp(STREAMFILE *streamFile) {
|
|||||||
fail:
|
fail:
|
||||||
clean_txtp(txtp);
|
clean_txtp(txtp);
|
||||||
close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
free_layout_segmented(data_s);
|
if (!vgmstream) {
|
||||||
free_layout_layered(data_l);
|
free_layout_segmented(data_s);
|
||||||
|
free_layout_layered(data_l);
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user