[vlc-devel] [RFC 38/38] access/vcd: replaced usage of xrealloc
Filip Roséen
filip at videolabs.io
Mon Jun 27 13:43:49 CEST 2016
---
modules/access/vcd/vcd.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/modules/access/vcd/vcd.c b/modules/access/vcd/vcd.c
index bbd4dfb..332f6f3 100644
--- a/modules/access/vcd/vcd.c
+++ b/modules/access/vcd/vcd.c
@@ -486,11 +486,16 @@ static int EntryPoints( access_t *p_access )
msg_Dbg( p_access, "Entry[%d] title=%d sector=%d",
i, i_title, i_sector );
- p_sys->titles[i_title].seekpoints = xrealloc(
- p_sys->titles[i_title].seekpoints,
+ uint64_t *seekpoints = realloc( p_sys->titles[i_title].seekpoints,
sizeof( uint64_t ) * (p_sys->titles[i_title].count + 1) );
- p_sys->titles[i_title].seekpoints[p_sys->titles[i_title].count++] =
+
+ if( unlikely( !seekpoints ) )
+ return VLC_ENOMEM;
+
+ seekpoints[ p_sys->titles[i_title].count++ ] =
(i_sector - p_sys->p_sectors[i_title+1]) * VCD_DATA_SIZE;
+
+ p_sys->titles[i_title].seekpoints = seekpoints;
}
return VLC_SUCCESS;
--
2.9.0
More information about the vlc-devel
mailing list