Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 353fa81

Browse files
committed
Resolving source validation errors
1 parent 9f30f3b commit 353fa81

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/brain/tf_session_entity/tf_session_entity.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "brain/tf_session_entity/tf_session_entity.h"
14-
#include <include/common/logger.h>
15-
#include <include/common/macros.h>
1614

1715
namespace peloton {
1816
namespace brain {
@@ -43,7 +41,7 @@ TFSE_TYPE::~TfSessionEntity() {
4341

4442
TFSE_TEMPLATE_ARGUMENTS
4543
void TFSE_TYPE::FreeBuffer(void *data, UNUSED_ATTRIBUTE size_t length) {
46-
free(data);
44+
::operator delete(data);
4745
}
4846

4947
TFSE_TEMPLATE_ARGUMENTS
@@ -62,8 +60,9 @@ TF_Buffer *TFSE_TYPE::ReadFile(const std::string &filename) {
6260
fseek(f, 0, SEEK_END);
6361
size_t fsize = (size_t)ftell(f);
6462
fseek(f, 0, SEEK_SET); // same as rewind(f);
65-
66-
void *data = malloc(fsize);
63+
// Reference:
64+
// https://stackoverflow.com/questions/14111900/using-new-on-void-pointer
65+
void *data = ::operator new(fsize);
6766
fread(data, fsize, 1, f);
6867
fclose(f);
6968

src/brain/tf_session_entity/tf_session_entity_input.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "brain/tf_session_entity/tf_session_entity_input.h"
14-
#include <include/common/macros.h>
1514

1615
namespace peloton {
1716
namespace brain {

src/include/brain/tf_session_entity/tf_session_entity_io.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <iostream>
2020
#include <type_traits>
2121
#include <vector>
22+
#include "common/logger.h"
23+
#include "common/macros.h"
2224

2325
#define TFSEIO_BASE_TEMPLATE_ARGUMENTS template <typename N>
2426
#define TFSEIO_BASE_TYPE TfSessionEntityIOBase<N>

0 commit comments

Comments
 (0)