Alex Henrie : quartz: Rewrite add_data with CoTaskMemRealloc and error handling.
Alexandre Julliard
julliard at winehq.org
Wed Aug 15 14:39:54 CDT 2018
Module: wine
Branch: master
Commit: 24703e4cd63401079bb6f3a734c25fadd4ae620d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=24703e4cd63401079bb6f3a734c25fadd4ae620d
Author: Alex Henrie <alexhenrie24 at gmail.com>
Date: Tue Aug 14 09:25:10 2018 -0600
quartz: Rewrite add_data with CoTaskMemRealloc and error handling.
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/quartz/filtermapper.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c
index 0d26198..0a41c71 100644
--- a/dlls/quartz/filtermapper.c
+++ b/dlls/quartz/filtermapper.c
@@ -145,11 +145,11 @@ static int add_data(struct Vector * v, const BYTE * pData, int size)
int index = v->current;
if (v->current + size > v->capacity)
{
- LPBYTE pOldData = v->pData;
- v->capacity = (v->capacity + size) * 2;
- v->pData = CoTaskMemAlloc(v->capacity);
- memcpy(v->pData, pOldData, v->current);
- CoTaskMemFree(pOldData);
+ int new_capacity = (v->capacity + size) * 2;
+ BYTE *new_data = CoTaskMemRealloc(v->pData, new_capacity);
+ if (!new_data) return -1;
+ v->capacity = new_capacity;
+ v->pData = new_data;
}
memcpy(v->pData + v->current, pData, size);
v->current += size;
More information about the wine-cvs
mailing list