avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r818297 - in /hadoop/avro/trunk: CHANGES.txt src/c++/Makefile src/c++/System.Darwin.mk src/c++/System.Linux.mk src/c++/parser/avro.l
Date Wed, 23 Sep 2009 22:40:42 GMT
Author: cutting
Date: Wed Sep 23 22:40:41 2009
New Revision: 818297

URL: http://svn.apache.org/viewvc?rev=818297&view=rev
Log:
AVRO-117.  Fix memory leak in C++ JSON parser.  Contributed by Scott Banachowski.

Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/src/c++/Makefile
    hadoop/avro/trunk/src/c++/System.Darwin.mk
    hadoop/avro/trunk/src/c++/System.Linux.mk
    hadoop/avro/trunk/src/c++/parser/avro.l

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=818297&r1=818296&r2=818297&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Wed Sep 23 22:40:41 2009
@@ -28,6 +28,9 @@
     AVRO-113.  Fix endian bug with C++ integer/long varint codec.
     (Scott Banachowski via cutting)
 
+    AVRO-117.  Fix memory leak in C++ JSON parser.
+    (Scott Banachowski via cutting)
+
 Avro 1.1.0 (8 September 2009)
 
   INCOMPATIBLE CHANGES

Modified: hadoop/avro/trunk/src/c++/Makefile
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c%2B%2B/Makefile?rev=818297&r1=818296&r2=818297&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c++/Makefile (original)
+++ hadoop/avro/trunk/src/c++/Makefile Wed Sep 23 22:40:41 2009
@@ -4,6 +4,8 @@
 
 INCFLAGS = -I./api -I./parser -I.
 INCFLAGS += -isystem$(BOOSTINC)
+# include any flags defined in System.X.mk
+INCFLAGS += $(SYSTEM_INCFLAGS)
 
 LIBS = $(BOOSTREGEX)
 

Modified: hadoop/avro/trunk/src/c++/System.Darwin.mk
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c%2B%2B/System.Darwin.mk?rev=818297&r1=818296&r2=818297&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c++/System.Darwin.mk (original)
+++ hadoop/avro/trunk/src/c++/System.Darwin.mk Wed Sep 23 22:40:41 2009
@@ -5,7 +5,7 @@
 
 BOOSTREGEX=$(BOOSTLIB)/libboost_regex-gcc40-mt.a
 
-# tested with flex 2.5.4 and 2.5.33
+# tested with flex 2.5.4, 2.5.27, 31, 33, 34 and 35
 LEX=/usr/bin/flex
 
 # tested with bison 1.28, 1.875c, and 2.3

Modified: hadoop/avro/trunk/src/c++/System.Linux.mk
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c%2B%2B/System.Linux.mk?rev=818297&r1=818296&r2=818297&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c++/System.Linux.mk (original)
+++ hadoop/avro/trunk/src/c++/System.Linux.mk Wed Sep 23 22:40:41 2009
@@ -4,7 +4,7 @@
 
 BOOSTREGEX=$(BOOSTLIB)/libboost_regex-gcc42-mt-1_34_1.a
 
-# tested with flex 2.5.4 and 2.5.33
+# tested with flex 2.5.4, 2.5.27, 31, 33, 34 and 35
 LEX=/usr/bin/flex
 
 # tested with bison 1.28, 1.875c, and 2.3

Modified: hadoop/avro/trunk/src/c++/parser/avro.l
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c%2B%2B/parser/avro.l?rev=818297&r1=818296&r2=818297&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c++/parser/avro.l (original)
+++ hadoop/avro/trunk/src/c++/parser/avro.l Wed Sep 23 22:40:41 2009
@@ -168,6 +168,31 @@
 {startunion}                    yy_push_state(INUNION); return yytext[0];
 \"                              yy_push_state(READTYPE); return AVRO_LEX_SIMPLE_TYPE;
 {ws}                            ;
+<<EOF>>                         {
+#if !YY_FLEX_SUBMINOR_VERSION || YY_FLEX_SUBMINOR_VERSION < 27
+// The versions of flex before 3.5.27 do not free their stack when done, so explcitly free
it.
+// Note that versions before did not actually define a subminor macro.
+                                    if (yy_start_stack) {
+                                        yy_flex_free(yy_start_stack);
+                                        yy_start_stack = 0;
+                                    }
+#endif
+#if YY_FLEX_SUBMINOR_VERSION > 35
+// At this time, 3.5.35 is the latest version.
+#warning "Warning:  untested version of flex"
+#endif
+#if YY_FLEX_SUBMINOR_VERSION >= 31 && YY_FLEX_SUBMINOR_VERSION < 34
+// The versions of flex starting 3.5.31 do not free yy_buffer_stack, so do so 
+// explicitly (first yy_delete_buffer must be called to free pointers stored on the stack,
then it is
+// safe to remove the stack).  This was fixed in 3.4.34.
+                                    if(yy_buffer_stack) {
+                                        yy_delete_buffer(YY_CURRENT_BUFFER);
+                                        yyfree(yy_buffer_stack);
+                                        yy_buffer_stack = 0;
+                                    }
+#endif
+                                    yyterminate();
+                                }
 
 %%
 



Mime
View raw message