mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
- Check parameters before allocating memory
- Patch by Daniel Zimmermann, <netzimme AT aim DOT com> - Fixes possible memory leaks pointed out by CID 605, bug #3910 svn path=/trunk/; revision=37628
This commit is contained in:
parent
f7f455d197
commit
215fa4be9d
|
@ -233,6 +233,8 @@ size_t wcsftime(wchar_t* s, size_t maxsize, const wchar_t* format, const struct
|
|||
char *x;
|
||||
char *f;
|
||||
size_t i,j;
|
||||
if ((gsize = maxsize) < 1)
|
||||
return 0;
|
||||
x = malloc(maxsize);
|
||||
j = wcslen(format);
|
||||
f = malloc(j+1);
|
||||
|
@ -240,8 +242,6 @@ size_t wcsftime(wchar_t* s, size_t maxsize, const wchar_t* format, const struct
|
|||
f[i] = (char)*format;
|
||||
f[i] = 0;
|
||||
pt = x;
|
||||
if ((gsize = maxsize) < 1)
|
||||
return 0;
|
||||
if (_fmt(f, t)) {
|
||||
*pt = '\0';
|
||||
free(f);
|
||||
|
|
Loading…
Reference in a new issue