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_UNINIT_PTR



FREE_UNINIT_PTR

Freeing uninitialized pointer

This error is generated whenever an attempt is made to de-allocate memory by means of an uninitialized pointer.

Problem

This code attempts to free a pointer which has not been initialized.


	1:	/*
	2:	 * File: freeuptr.c
	3:	 */
	4:	main()
	5	{
	6:		char *a;
	7:		free(a); bug
	8:		return (0);
	9:	}

Diagnosis


	[freeuptr.c:7] **FREE_UNINIT_PTR**
1.	>> 		free(a);
	
2.		Freeing uninitialized pointer: a

		Stack trace where the error occurred:
3.				 main() freeuptr.c, 7
	
4.		**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. Stack trace showing the function call sequence leading to the error.
  4. Informational message indicating that a serious error has occurred which may cause the program to crash.

Repair

Some systems appear to allow this operation, since they will refuse to free memory that was not dynamically allocated. Relying on this behavior is very dangerous, however, since an uninitialized pointer may "accidentally" point to a block of memory that was dynamically allocated, but should not be freed.


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