Questions tagged [double-free]

94 questions
0
votes
1 answer

Correctly exit forked process in C++

Reading the answer to How to end C++ code, I learned that calling exit from C++ code is bad. But what if I have forked a child process which must end somewhere and is so deep down the call stack that passing down its exit code to main would be…
user1978011
  • 3,419
  • 25
  • 38
0
votes
2 answers

Double free() occurrence where it should not

I have a frustrating problem for which I can't find an answer to. I have this function: // Append character to the end of a string void str_AppendChar(char* s, const char* ch) { // +2 because of 2x '\0' char* buff =…
B Mutev
  • 3
  • 2
0
votes
3 answers

Double free or corruption error with string assignment

I am having errors in string assignment here. This is a function we coded for storing data fetched from a url. edit : datanode structure struct node { string url; std::string* data; struct node* next; struct node* prev; }; …
sai pallavi
  • 147
  • 3
  • 10
0
votes
1 answer

double free or corruption (fasttop) when use recursive method in C++

I implemented a Stack class and tried to make use of that class to solve Hanoi Problem. Here is my code: template class Node { public: Node() { next = NULL; prev = NULL; } …
Shanpei Zhou
  • 371
  • 1
  • 2
  • 17
-1
votes
1 answer

Double free or corruption error in python

I am using pygame on replit and am getting an unsual error. This error usually comes from a c or c++ compiler when you attempt to free the same memory twice, but this is python. I think it is a replit issue because the error doesn't happen in atom…
Jacob
  • 135
  • 2
  • 12
-1
votes
1 answer

Double free reported in my code using openssl 1.0.2k

I am using openssl library 1.0.2k in my application. In some random situations, a double free error condition is occurring. The basic code flow is: BIO* sbio = NULL; if (!(con = (SSL *) SSL_new(ctx))) { sprintf(ReturnBuf, "sweb: Cannot create…
-1
votes
1 answer

c++ deleting a pointer from 2 sets of pointers

I have 2 sets of pointers where I want to delete a certain pointer from. But it's giving me a double free error at the last line in the delete edge function. I initially suspected that maybe it was because set::erase() was implicitly calling delete…
funnypig run
  • 182
  • 2
  • 9
-1
votes
3 answers

What exactly happens when I do buffer1.push_back(buffer2.front()) in C++?

Help me understand this. Here is the context. I am writing a program in C++. I have 2 buffers (deque). Let's call them buffer1 and buffer2; I have 2 threads: one thread is filling buffer1 with random values. The other one is copying the oldest…
Filipe Santos
  • 61
  • 2
  • 9
-1
votes
2 answers

*** Error in `./a.out': double free or corruption (!prev): 0x096fb008 *** Aborted (core dumped)

I am getting the error same as the title. I think it is happening because of matrix A but can't understand why and how to fix it. Kindly help me out. Here is the complete code. I am using g++ to compile the code. #include #include…
Goyal
  • 15
  • 1
  • 1
-1
votes
1 answer

Double free error deallocating a 2d array

I'm working on a program that uses a structure with 2d array as fields. But for some reason evrytime I try to use the free_planet function I receive a double free error. Using programs as valgrind it seems the problems are the instructions from row…
IXion
  • 11
  • 2
-1
votes
2 answers

Double free or corruption- why?

class matrix{ private: int n, *wsk; friend istream & operator>>(istream&,matrix&); friend ostream & operator<<(ostream&,matrix&); public: matrix(){ wsk=0; n=0; } …
oszust002
  • 65
  • 6
-1
votes
2 answers

Double-free error in execution after deleting pointer in deconstructor

I have a class containing a member pointer which is dynamically allocated in its constructor as follows: class Record { public: Record(unsigned short numBytes, char* bufRecord); ~Record(); unsigned short size() {return…
cgurleyuk
  • 151
  • 7
-2
votes
1 answer

Why does a double free occur?

I've been trying to write a spell checker program that takes a dictionary and a text file to find the misspelled words as fast as possible. However, I get an error message stating that a double free occurred on running the program. I'd like to know…
MelPradeep
  • 35
  • 5
-2
votes
1 answer

double free or corruption when trying to erase in unordered_map

I have a class Block that inherits from a class case : class Case { public: Case(sf::Vector2f const& pos, sf::IntRect const& textureRect, int type = 1); protected: int type_; sf::Vector2f pos_; sf::FloatRect hitBox_; …
-2
votes
2 answers

Program in C who reads a file and transform his characters produces a double free or corruption error

When executing my program, I have this error: *** Error in `./xorcipher': double free or corruption (!prev): 0x00000000024a1010 *** ======= Backtrace:…