Changeset 99f80c178a8236c18400150fff4d436f127e41b8
- Timestamp:
- 03/16/08 22:30:41
(5 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1205703041 +0200
- git-parent:
[7061a05d461803044bd98b63fed47340736e9809]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1205702579 +0200
- Message:
Handle all memory errors in MP4 esds
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r7061a05 |
r99f80c1 |
|
| 886 | 886 | } |
|---|
| 887 | 887 | |
|---|
| | 888 | |
|---|
| | 889 | static void MP4_FreeBox_esds( MP4_Box_t *p_box ) |
|---|
| | 890 | { |
|---|
| | 891 | FREENULL( p_box->data.p_esds->es_descriptor.psz_URL ); |
|---|
| | 892 | if( p_box->data.p_esds->es_descriptor.p_decConfigDescr ) |
|---|
| | 893 | { |
|---|
| | 894 | FREENULL( p_box->data.p_esds->es_descriptor.p_decConfigDescr->p_decoder_specific_info ); |
|---|
| | 895 | FREENULL( p_box->data.p_esds->es_descriptor.p_decConfigDescr ); |
|---|
| | 896 | } |
|---|
| | 897 | } |
|---|
| | 898 | |
|---|
| 888 | 899 | static int MP4_ReadBox_esds( stream_t *p_stream, MP4_Box_t *p_box ) |
|---|
| 889 | 900 | { |
|---|
| … | … | |
| 892 | 903 | unsigned int i_flags; |
|---|
| 893 | 904 | unsigned int i_type; |
|---|
| | 905 | unsigned int code = 0; |
|---|
| 894 | 906 | |
|---|
| 895 | 907 | MP4_READBOX_ENTER( MP4_Box_data_esds_t ); |
|---|
| … | … | |
| 959 | 971 | es_descriptor.p_decConfigDescr = |
|---|
| 960 | 972 | malloc( sizeof( MP4_descriptor_decoder_config_t )); |
|---|
| | 973 | if( es_descriptor.p_decConfigDescr == NULL ) |
|---|
| | 974 | { |
|---|
| | 975 | free( es_descriptor.psz_URL ); |
|---|
| | 976 | goto error; |
|---|
| | 977 | } |
|---|
| 961 | 978 | |
|---|
| 962 | 979 | MP4_GET1BYTE( es_descriptor.p_decConfigDescr->i_objectTypeIndication ); |
|---|
| … | … | |
| 984 | 1001 | es_descriptor.p_decConfigDescr->i_decoder_specific_info_len = i_len; |
|---|
| 985 | 1002 | es_descriptor.p_decConfigDescr->p_decoder_specific_info = malloc( i_len ); |
|---|
| 986 | | if( es_descriptor.p_decConfigDescr->p_decoder_specific_info ) |
|---|
| 987 | | memcpy( es_descriptor.p_decConfigDescr->p_decoder_specific_info, |
|---|
| 988 | | p_peek, i_len ); |
|---|
| 989 | | |
|---|
| 990 | | MP4_READBOX_EXIT( 1 ); |
|---|
| | 1003 | if( es_descriptor.p_decConfigDescr->p_decoder_specific_info == NULL ) |
|---|
| | 1004 | { |
|---|
| | 1005 | MP4_FreeBox_esds( p_box ); |
|---|
| | 1006 | goto error; |
|---|
| | 1007 | } |
|---|
| | 1008 | memcpy( es_descriptor.p_decConfigDescr->p_decoder_specific_info, |
|---|
| | 1009 | p_peek, i_len ); |
|---|
| | 1010 | code = 1; |
|---|
| | 1011 | |
|---|
| | 1012 | error: |
|---|
| | 1013 | MP4_READBOX_EXIT( code ); |
|---|
| 991 | 1014 | |
|---|
| 992 | 1015 | #undef es_descriptor |
|---|
| 993 | 1016 | } |
|---|
| 994 | 1017 | |
|---|
| 995 | | static void MP4_FreeBox_esds( MP4_Box_t *p_box ) |
|---|
| 996 | | { |
|---|
| 997 | | FREENULL( p_box->data.p_esds->es_descriptor.psz_URL ); |
|---|
| 998 | | if( p_box->data.p_esds->es_descriptor.p_decConfigDescr ) |
|---|
| 999 | | { |
|---|
| 1000 | | FREENULL( p_box->data.p_esds->es_descriptor.p_decConfigDescr->p_decoder_specific_info ); |
|---|
| 1001 | | } |
|---|
| 1002 | | FREENULL( p_box->data.p_esds->es_descriptor.p_decConfigDescr ); |
|---|
| 1003 | | } |
|---|
| 1004 | 1018 | |
|---|
| 1005 | 1019 | static int MP4_ReadBox_avcC( stream_t *p_stream, MP4_Box_t *p_box ) |
|---|