Search

ParaSoft

HOME
PRODUCTS
SUPPORT
ABOUT
WHAT'S NEW
EVENTS


Insure++

Quick facts

Add-on Modules:
   -INUSE
   -TCA

Comparisons

Technical Papers

Support & Manuals

FAQs

Recent Reviews

User Testimonials

Press Releases


Insure tool to debug c++





Insure++ Reference - FREE_BODY



FREE_BODY

Freeing memory block from body

This error is generated when an attempt is made to de-allocate memory by using a pointer which currently points into the middle of a block, rather than to its beginning.

Problem

The following code attempts to free a memory region using an invalid pointer.


	1:	/*
	2:	 * File: freebody.c
	3:	 */
	4:	#include <stdlib.h>
	5:	
	6:	main()
	7:	{
	8:		char *a = (char *)malloc(10);
	9:		free(a+1); bug
	10:	}

Diagnosis (at runtime)


	[freebody.c:9] **FREE_BODY**
1.	>> 		free(a+1);
	
2.		Freeing memory block from body: a + 1
	
3.		Pointer		: 0x000173e9
		Stack trace where the error occurred:
4.				main() freebody.c, 9
	
5.		**Memory corrupted. Program may crash!!**


  1. Source line at which the problem was detected.
  2. Description of the problem and the expression that is in error.
  3. Value of the pointer that is being deallocated.
  4. Stack trace showing the function call sequence leading to the error.
  5. Informational message indicating that a serious error has occurred which may cause the program to crash.

Repair

This is normally a serious error. In most cases, the line number indicated in the diagnostics will have a simple error that can be corrected.


< EXPR_WILD > FREE_DANGLING
Tools to debug c++ and java
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft