Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ build:asan --config=sanitizer
# ASAN install its signal handler, disable ours so the stacktrace will be printed by ASAN
build:asan --define signal_trace=disabled
build:asan --define ENVOY_CONFIG_ASAN=1
build:asan --copt -fsanitize=address,undefined
build:asan --linkopt -fsanitize=address,undefined
build:asan --copt -fsanitize=leak
build:asan --linkopt -fsanitize=leak
build:asan --copt=-fno-omit-frame-pointer
#build:asan --copt -fsanitize=address,undefined
#build:asan --linkopt -fsanitize=address,undefined
# vptr and function sanitizer are enabled in clang-asan if it is set up via bazel/setup_clang.sh.
build:asan --copt -fno-sanitize=vptr,function
build:asan --linkopt -fno-sanitize=vptr,function
build:asan --linkopt -fno-omit-frame-pointer
build:asan --copt -DADDRESS_SANITIZER=1
build:asan --copt -D__SANITIZE_ADDRESS__
build:asan --test_env=ASAN_OPTIONS=handle_abort=1:allow_addr2line=true:check_initialization_order=true:strict_init_order=true:detect_odr_violation=1
Expand Down Expand Up @@ -116,6 +120,7 @@ build:libc++ --action_env=BAZEL_CXXOPTS=-stdlib=libc++
build:libc++ --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a
build:libc++ --action_env=BAZEL_LINKOPTS=-lm:-pthread
build:libc++ --define force_libcpp=enabled
#lambdai build:libc++ --copt -fsanitize=leak

# Optimize build for binary size reduction.
build:sizeopt -c opt --copt -Os
Expand Down
15 changes: 13 additions & 2 deletions source/exe/main.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "common/common/macros.h"
#include "exe/main_common.h"

#include <iostream>
// NOLINT(namespace-envoy)

/**
Expand All @@ -9,4 +10,14 @@
* deployment such as initializing signal handling. It calls main_common
* after setting up command line options.
*/
int main(int argc, char** argv) { return Envoy::MainCommon::main(argc, argv); }
int main(int argc, char** argv) {
auto pnew = new (int)(7);
pnew = nullptr; // The memory is leaked here.
auto pmalloc = malloc(7);
pmalloc = nullptr; // The memory is leaked here.
std::cout << "foo: after malloc and new" << std::endl;
return Envoy::MainCommon::main(argc, argv);
// UNREFERENCED_PARAMETER(argc);
// UNREFERENCED_PARAMETER(argv);
// return 0;
}