Top "Free" questions

Do not use this tag to refer to free software.

How to track down a "double free or corruption" error

When I run my (C++) program it crashes with this error. * glibc detected * ./load: double free or corruption (!prev): 0x0000000000…

c++ c debugging free
How do malloc() and free() work?

I want to know how malloc and free work. int main() { unsigned char *p = (unsigned char*)malloc(4*sizeof(unsigned char)); …

c++ c memory-management malloc free
C free(): invalid pointer

I am teaching myself C. My goal is to make a C function that just walks a query string and …

c pointers free valgrind
What REALLY happens when you don't free after malloc?

This has been something that has bothered me for ages now. We are all taught in school (at least, I …

c malloc free
double free or corruption (!prev) error in c program

I get the following error when running a c program: *** glibc detected *** ./a.out: double free or corruption (!prev): 0x080…

c free
Setting variable to NULL after free

In my company there is a coding rule that says, after freeing any memory, reset the variable to NULL. For …

c coding-style malloc free heap-memory
Does free(ptr) where ptr is NULL corrupt memory?

Theoretically I can say that free(ptr); free(ptr); is a memory corruption since we are freeing the memory which …

c pointers memory-management null free
Understanding "corrupted size vs. prev_size" glibc error

I have implemented a JNA bridge to FDK-AAC. Source code can be found in here When bench-marking my code, I …

c++ malloc free jna glibc
How do free and malloc work in C?

I'm trying to figure out what would happened if I try to free a pointer "from the middle" for example, …

c memory free malloc
LinkedList - How to free the memory allocated using malloc

I have a very simple C code for constructing a Singly Linked list as below, in which I allocate memory …

c linked-list malloc free