[libbdplus-devel] Fix leak when realloc fails
anonymous
git at videolan.org
Wed Apr 29 12:47:08 CEST 2015
libbdplus | branch: master | anonymous <anonymous at anonymous.org> | Wed Apr 29 13:20:32 2015 +0300| [befe2eac56774ba90804cb737805db2b1b042a52] | committer: anonymous
Fix leak when realloc fails
> http://git.videolan.org/gitweb.cgi/libbdplus.git/?a=commit;h=befe2eac56774ba90804cb737805db2b1b042a52
---
src/libbdplus/bdsvm/segment.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/libbdplus/bdsvm/segment.c b/src/libbdplus/bdsvm/segment.c
index 8aba40b..69f057c 100644
--- a/src/libbdplus/bdsvm/segment.c
+++ b/src/libbdplus/bdsvm/segment.c
@@ -518,10 +518,12 @@ uint32_t segment_mergeTables(conv_table_t *set1, conv_table_t *set2)
if (!numMergeTables) return 0;
// Grow the list to hold the new tables.
+ void *tmp = set1->Tables;
set1->Tables = (subtable_t *) realloc(set1->Tables,
(set1->numTables + numMergeTables) *
sizeof(subtable_t));
if (!set1->Tables) {
+ X_FREE(tmp);
set1->numTables = 0;
BD_DEBUG(DBG_BDPLUS,"[segment] Out of memory.\n");
return 0;
More information about the libbdplus-devel
mailing list