[Python-checkins] r71230 - python/branches/py3k-short-float-repr/Python/dtoa.c

mark.dickinson python-checkins at python.org
Sun Apr 5 14:47:30 CEST 2009


Author: mark.dickinson
Date: Sun Apr  5 14:47:30 2009
New Revision: 71230

Log:
More return value checks, in lshift, diff and d2b

Modified:
   python/branches/py3k-short-float-repr/Python/dtoa.c

Modified: python/branches/py3k-short-float-repr/Python/dtoa.c
==============================================================================
--- python/branches/py3k-short-float-repr/Python/dtoa.c	(original)
+++ python/branches/py3k-short-float-repr/Python/dtoa.c	Sun Apr  5 14:47:30 2009
@@ -759,6 +759,10 @@
 	for(i = b->maxwds; n1 > i; i <<= 1)
 		k1++;
 	b1 = Balloc(k1);
+	if (b1 == NULL) {
+		Bfree(b);
+		return NULL;
+	}
 	x1 = b1->x;
 	for(i = 0; i < n; i++)
 		*x1++ = 0;
@@ -830,6 +834,8 @@
 	i = cmp(a,b);
 	if (!i) {
 		c = Balloc(0);
+		if (c == NULL)
+			return NULL;
 		c->wds = 1;
 		c->x[0] = 0;
 		return c;
@@ -843,6 +849,8 @@
 	else
 		i = 0;
 	c = Balloc(a->k);
+	if (c == NULL)
+		return NULL;
 	c->sign = i;
 	wa = a->wds;
 	xa = a->x;
@@ -976,6 +984,8 @@
 #define d1 word1(d)
 
 	b = Balloc(1);
+	if (b == NULL)
+		return NULL;
 	x = b->x;
 
 	z = d0 & Frac_mask;


More information about the Python-checkins mailing list