diff --git a/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc b/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
index d40c3313..c355c0fe 100644
--- a/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
+++ b/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
@@ -696,7 +696,7 @@ uint32_t TCompactProtocolT<Transport_>::readBinary(std::string& str) {
 
   // Use the heap here to prevent stack overflow for v. large strings
   if (size > string_buf_size_ || string_buf_ == NULL) {
-    void* new_string_buf = std::realloc(string_buf_, (uint32_t)size);
+    void* new_string_buf = realloc(string_buf_, (uint32_t)size);
     if (new_string_buf == NULL) {
       throw std::bad_alloc();
     }
