Fix resizing the string buffer.

Issue=117
TRAC #15793
Signed-off-by: Daniel Koch
Author: Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/trunk@605 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/version.h b/src/common/version.h
index 0a94b1e..796b435 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
 #define MAJOR_VERSION 0
 #define MINOR_VERSION 0
 #define BUILD_VERSION 0
-#define BUILD_REVISION 604
+#define BUILD_REVISION 605
 
 #define STRINGIFY(x) #x
 #define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/compiler/preprocessor/atom.c b/src/compiler/preprocessor/atom.c
index c5636b7..b4a7761 100644
--- a/src/compiler/preprocessor/atom.c
+++ b/src/compiler/preprocessor/atom.c
@@ -182,12 +182,13 @@
     char *str;
 
     len = (int) strlen(s);
-    if (stable->nextFree + len + 1 >= stable->size) {
+    while (stable->nextFree + len + 1 >= stable->size) {
         assert(stable->size < 1000000);
         str = (char *) malloc(stable->size*2);
         memcpy(str, stable->strings, stable->size);
         free(stable->strings);
         stable->strings = str;
+        stable->size = stable->size*2;
     }
     loc = stable->nextFree;
     strcpy(&stable->strings[loc], s);