summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2012-10-31 20:56:41 +0000
committerwm4 <wm4@nowhere>2012-10-31 22:46:40 +0100
commit83f8d34a073993016eda6ba4e0807e3e13833b4b (patch)
tree6283144f46c5130d10db9ab67b7dfa1609f236b4
parent6c141b60b5609cf1a3ec9163039fe37a3825824e (diff)
downloadmpv-83f8d34a073993016eda6ba4e0807e3e13833b4b.tar.bz2
mpv-83f8d34a073993016eda6ba4e0807e3e13833b4b.tar.xz
demux_ts: remove some incorrect usages of realloc_struct
Remove some incorrect usages of realloc_struct. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35318 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmpdemux/demux_ts.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c
index 6076fe13dc..b59066327d 100644
--- a/libmpdemux/demux_ts.c
+++ b/libmpdemux/demux_ts.c
@@ -1754,7 +1754,6 @@ static int parse_pat(ts_priv_t * priv, int is_start, unsigned char *buff, int si
unsigned char *base;
int entries, i;
uint16_t progid;
- struct pat_progs_t *tmp;
ts_section_t *section;
section = &(priv->pat.section);
@@ -1788,14 +1787,14 @@ static int parse_pat(ts_priv_t * priv, int is_start, unsigned char *buff, int si
if((idx = prog_idx_in_pat(priv, progid)) == -1)
{
- int sz = sizeof(struct pat_progs_t) * (priv->pat.progs_cnt+1);
- tmp = realloc_struct(priv->pat.progs, priv->pat.progs_cnt+1, sizeof(struct pat_progs_t));
- if(tmp == NULL)
+ priv->pat.progs = realloc_struct(priv->pat.progs, priv->pat.progs_cnt+1, sizeof(struct pat_progs_t));
+ if(!priv->pat.progs)
{
+ int sz = sizeof(struct pat_progs_t) * (priv->pat.progs_cnt+1);
+ priv->pat.progs_cnt = 0;
mp_msg(MSGT_DEMUX, MSGL_ERR, "PARSE_PAT: COULDN'T REALLOC %d bytes, NEXT\n", sz);
break;
}
- priv->pat.progs = tmp;
idx = priv->pat.progs_cnt;
priv->pat.progs_cnt++;
}
@@ -2047,7 +2046,7 @@ static uint16_t parse_mp4_es_descriptor(pmt_t *pmt, uint8_t *buf, int len)
{
int i = 0, j = 0, k, found;
uint8_t flag;
- mp4_es_descr_t es, *target_es = NULL, *tmp;
+ mp4_es_descr_t es, *target_es = NULL;
mp_msg(MSGT_DEMUX, MSGL_V, "PARSE_MP4ES: len=%d\n", len);
memset(&es, 0, sizeof(mp4_es_descr_t));
@@ -2082,13 +2081,13 @@ static uint16_t parse_mp4_es_descriptor(pmt_t *pmt, uint8_t *buf, int len)
if(! found)
{
- tmp = realloc_struct(pmt->mp4es, pmt->mp4es_cnt+1, sizeof(mp4_es_descr_t));
- if(tmp == NULL)
+ pmt->mp4es = realloc_struct(pmt->mp4es, pmt->mp4es_cnt+1, sizeof(mp4_es_descr_t));
+ if(!pmt->mp4es)
{
+ pmt->mp4es_cnt = 0;
fprintf(stderr, "CAN'T REALLOC MP4_ES_DESCR\n");
continue;
}
- pmt->mp4es = tmp;
target_es = &(pmt->mp4es[pmt->mp4es_cnt]);
pmt->mp4es_cnt++;
}
@@ -2423,8 +2422,6 @@ static int parse_pmt(ts_priv_t * priv, uint16_t progid, uint16_t pid, int is_sta
int32_t idx, es_count, section_bytes;
uint8_t m=0;
int skip;
- pmt_t *tmp;
- struct pmt_es_t *tmp_es;
ts_section_t *section;
ES_stream_t *tss;
int i;
@@ -2433,14 +2430,14 @@ static int parse_pmt(ts_priv_t * priv, uint16_t progid, uint16_t pid, int is_sta
if(idx == -1)
{
- int sz = (priv->pmt_cnt + 1) * sizeof(pmt_t);
- tmp = realloc_struct(priv->pmt, priv->pmt_cnt + 1, sizeof(pmt_t));
- if(tmp == NULL)
+ priv->pmt = realloc_struct(priv->pmt, priv->pmt_cnt + 1, sizeof(pmt_t));
+ if(!priv->pmt)
{
+ int sz = (priv->pmt_cnt + 1) * sizeof(pmt_t);
+ priv->pmt_cnt = 0;
mp_msg(MSGT_DEMUX, MSGL_ERR, "PARSE_PMT: COULDN'T REALLOC %d bytes, NEXT\n", sz);
return 0;
}
- priv->pmt = tmp;
idx = priv->pmt_cnt;
memset(&(priv->pmt[idx]), 0, sizeof(pmt_t));
priv->pmt_cnt++;
@@ -2494,14 +2491,14 @@ static int parse_pmt(ts_priv_t * priv, uint16_t progid, uint16_t pid, int is_sta
idx = es_pid_in_pmt(pmt, es_pid);
if(idx == -1)
{
- int sz = sizeof(struct pmt_es_t) * (pmt->es_cnt + 1);
- tmp_es = realloc_struct(pmt->es, pmt->es_cnt + 1, sizeof(struct pmt_es_t));
- if(tmp_es == NULL)
+ pmt->es = realloc_struct(pmt->es, pmt->es_cnt + 1, sizeof(struct pmt_es_t));
+ if(!pmt->es)
{
+ int sz = sizeof(struct pmt_es_t) * (pmt->es_cnt + 1);
+ pmt->es_cnt = 0;
mp_msg(MSGT_DEMUX, MSGL_ERR, "PARSE_PMT, COULDN'T ALLOCATE %d bytes for PMT_ES\n", sz);
continue;
}
- pmt->es = tmp_es;
idx = pmt->es_cnt;
memset(&(pmt->es[idx]), 0, sizeof(struct pmt_es_t));
pmt->es_cnt++;