Project

General

Profile

Actions

Bug #2842

closed

"double free" reported when smart pointer is created outside of the wrapper class

Added by Chengyu Fan almost 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
-
Start date:
05/28/2015
Due date:
% Done:

0%

Estimated time:

Description

The attached is the simple code to reproduce the "double free" error, and I ran it on a Ubuntu 14.04.1 LTS machine.

Expect result: exit normally

Actual result: get error messages

double free or corruption (fasttop): 0x0000000001277c20 ***
Aborted (core dumped)


Files

testChronoSync.tar.bz2 (102 KB) testChronoSync.tar.bz2 Chengyu Fan, 05/28/2015 08:01 PM

Related issues 2 (0 open2 closed)

Related to ndnSIM - Bug #2664: scenario template: ndn::Name double free in __cxa_finalizeClosedJunxiao Shi03/22/2015

Actions
Related to ndn-cxx - Bug #2853: Global variable in static library causes double free or corruption errorRejected06/05/2015

Actions
Actions #1

Updated by Chengyu Fan almost 9 years ago

I printed out the address in Name constructor of ndn-cxx library, and found that it is the Global variable CommandOptions::DEFAULT_PREFIX("ndn:/localhost/nfd") causes this issue.

As pointed out in https://gcc.gnu.org/ml/gcc-help/2010-10/msg00256.html, specify compiler flag "-fvisibility=hidden" in ndn-cxx could resolve this issue.

Actions #2

Updated by Junxiao Shi almost 9 years ago

  • Related to Bug #2664: scenario template: ndn::Name double free in __cxa_finalize added
Actions #3

Updated by Junxiao Shi almost 9 years ago

  • Related to Bug #2853: Global variable in static library causes double free or corruption error added
Actions #4

Updated by Chengyu Fan almost 9 years ago

I think the reason we have this issue might be:

  • Two DEFAULT_PREFIX are defined in ndn namespace in ndn-cxx library (ndn::DEFAULT_PREFIX in key-chain, ndn::nfd::DEFAULT_PREFIX in nfd-command-options), and the compiler has trouble to distinguish them.

A solution for Ubuntu 14 might be change one of the DEFAULT_PREFIX to something else, e.g., change ndn::nfd::DEFAULT_PREFIX to ndn::nfd::DEFAULT_LOCAL_PREFIX resolves this issue. However, this solution does not work on Fedora.

The compiler flag "-fvisibility=hidden" did remove the double free error, but it makes ChronoSync unitests fail on both Mac and Fedora.

Actions #5

Updated by Chengyu Fan almost 9 years ago

When the ndn-cxx library is built as shared, this bug is gone.

Actions #6

Updated by Alex Afanasyev over 6 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF