THRIFT-1361 revert compiler/cpp/src/thrifty.yy change
authorRoger Meier <roger@apache.org>
Sun, 6 Nov 2011 12:04:28 +0000 (12:04 +0000)
committerRoger Meier <roger@apache.org>
Sun, 6 Nov 2011 12:04:28 +0000 (12:04 +0000)
=> breaks mingw build
=> memleak fixes reported by cppcheck

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1198347 13f79535-47bb-0310-9956-ffa450edef68

compiler/cpp/src/thrifty.yy
lib/cpp/src/transport/TFileTransport.cpp
lib/cpp/test/TransportTest.cpp

index 7b4714d..cc024a1 100644 (file)
 #define __STDC_LIMIT_MACROS
 #define __STDC_FORMAT_MACROS
 #include <stdio.h>
-#ifndef _WIN32
 #include <inttypes.h>
-#else
-#include <stdint.h>
-#endif
 #include <limits.h>
 #include "main.h"
 #include "globals.h"
index 3121b43..47dc328 100644 (file)
@@ -250,6 +250,7 @@ void TFileTransport::enqueueEvent(const uint8_t* buf, uint32_t eventLen) {
   eventInfo* toEnqueue = new eventInfo();
   toEnqueue->eventBuff_ = (uint8_t *)std::malloc((sizeof(uint8_t) * eventLen) + 4);
   if (toEnqueue->eventBuff_ == NULL) {
+    delete toEnqueue;
     throw std::bad_alloc();
   }
   // first 4 bytes is the event length
index d12e384..767e563 100644 (file)
@@ -127,6 +127,7 @@ class GenericSizeGenerator : public SizeGenerator {
 template <class Transport_>
 class CoupledTransports {
  public:
+  virtual ~CoupledTransports() {}
   typedef Transport_ TransportType;
 
   CoupledTransports() : in(), out() {}