Questions tagged [double-free]
94 questions
2
votes
2 answers
Is it possible to ignore an Error 487 (ERROR_INVALID_ADDRESS) for UnMapViewOFFile()?
Good afternoon, We are trying to build a prototype of Memory Mapped File Caching program for use by Windows and Linux 32 bit applications. Every time we run the prototype we get an Error 487(Error Invalid Address) when we try call UnMapViewOfFile to…

Frank
- 1,406
- 2
- 16
- 42
2
votes
3 answers
Can rust guarantee I free an object with the right object pool?
Say I have defined my own object pool struct. Internally it keeps a Vec of all the objects and some data structure that lets it know which items in the vector are currently handed out and which are free. It has an allocate method that returns an…

Joseph Garvin
- 20,727
- 18
- 94
- 165
2
votes
2 answers
Is it safe to free a glib buffer twice?
Is it safe or forbidden to free twice a buffer allocated by glib g_malloc function?
char *buffer = g_malloc(10);
g_free(buffer);
g_free(buffer);

macro_controller
- 1,469
- 1
- 14
- 32
2
votes
1 answer
Double free on exception in Boost.Test
I'm having a problem that occurs while executing Boost.Test testcases on a cluster. The error is: *** glibc detected *** ...myprogram.test: corrupted double-linked list: 0x000000000096b4d0 ***
Running valgrind on this gives me:
==9687== Invalid…

Flamefire
- 5,313
- 3
- 35
- 70
2
votes
3 answers
Shared pointers: why no double free?
Why does this code NOT generate a double free when the shared pointers go out of scope?
int main()
{
{
auto * ptr = new int(1);
shared_ptr a( ptr );
shared_ptr b( ptr );
cout << "ok: " << *a << *b <<…

nyarlathotep108
- 5,275
- 2
- 26
- 64
2
votes
1 answer
Swift malloc_error_break crashes with double free
I'm working on an app that fetches data from a web API. Most of the time, it runs perfectly; however, sometimes I'll received the error:
malloc: *** error for object 0x7fc2b061de30: double free
*** set a breakpoint in malloc_error_break to…

genghiskhan
- 1,095
- 12
- 21
2
votes
2 answers
Why does this C code yields a double free or corruption?
Why is this code for the computation of the inner product of two vectors yields a double free or corruption error, when compiled with:
ejspeiro@Eduardo-Alienware-14:~/Dropbox/HPC-Practices$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
The…

Eduardo
- 697
- 8
- 26
2
votes
1 answer
How to avoid double free or corruption (fasttop) on copy assignment operators?
I have the following class, where I force the compiler to generate all the copy/move constructors and assignment operators.
class foo {
public:
float *x;
size_t size;
foo(int m){
size = m;
x = new float[size];}
…
user5262733
2
votes
5 answers
Double Free inside of a destructor upon adding to a vector
Hey, I am working on a drum machine, and am having problems with vectors.
Each Sequence has a list of samples, and the samples are ordered in a vector. However, when a sample is push_back on the vector, the sample's destructor is called, and…

Shawn Buckley
- 506
- 6
- 16
2
votes
3 answers
Recursive Method C++
I am practising linked list structure right now and I have written a program using that algorithm. In the program there is a recursive method to remove every element of the linked list. However, the program crashes in that method.
void exit()
{
…

Eray Tuncer
- 707
- 2
- 11
- 31
1
vote
3 answers
Confusing double free error message/memory leak in iPhone app
EDIT - added .h file
I'm having difficulty trying to find the cause of a double free error.
Steps taken to solve
1) Used the Zombies tool. Zombies reports that tid is being double freed
2) Set a breakpoint on malloc_error_break. This identifitied…

RNs_Ghost
- 1,687
- 5
- 25
- 39
1
vote
1 answer
Double free when use pcap_close and fclose simultaneously
FILE* file = fopen(some file)
pcap_t* pd = pcap_fopen_offline(file)
pcap_close(pd)
fclose(file)
This code occurs double free error.
Could you explain about this happening?
My Guess is that pd and file pointers are sharing some datas.

KS_No
- 13
- 3
1
vote
2 answers
difference between `delete this` and `this->~Obj` in C++
When I am writing a demo string class, in the copy assignment function, I try to clear itself through 'delete this' before copy.But it failed.
Str &operator=(const Str &s) {
if (this != &s) { // self-assignment check
…

ln vv
- 13
- 3
1
vote
0 answers
Not getting double free or corruption error on running program
I have written the following program which should give runtime error of double free corruption.
#include
#include
using namespace std;
int main()
{
shared_ptr shared3(new int);
*shared3 = 9;
int *raw =…

decoder_damsel
- 13
- 3
1
vote
2 answers
free(): double free detected in tcache 2 on calling overloaded assignment operator
I'm working on a university project where we are to implement some of the c++ string class as Mystring. I'm working on the overloaded assignment operator and this is the current code for it:
Mystring& Mystring::operator=(const Mystring& orig)
{
…

Drake Ford
- 13
- 3