Author: gschneider
Date: Tue Nov 25 06:53:21 2008
New Revision: 37628
URL:
http://svn.reactos.org/svn/reactos?rev=37628&view=rev
Log:
- 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
Modified:
trunk/reactos/lib/sdk/crt/time/strftime.c
Modified: trunk/reactos/lib/sdk/crt/time/strftime.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/strftime.…
==============================================================================
--- trunk/reactos/lib/sdk/crt/time/strftime.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/time/strftime.c [iso-8859-1] Tue Nov 25 06:53:21 2008
@@ -233,6 +233,8 @@
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 @@
f[i] = (char)*format;
f[i] = 0;
pt = x;
- if ((gsize = maxsize) < 1)
- return 0;
if (_fmt(f, t)) {
*pt = '\0';
free(f);