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 - COPY_UNINIT_PTR



COPY_UNINIT_PTR

Copying uninitialized pointer

This error is generated whenever an uninitialized pointer is copied.

Bend
This error category will be disabled if full uninitialized memory checking is in effect (the default). In this case, errors are detected in the READ_UNINIT_MEM category instead.

Problem

The pointer a is declared in line 5, but is never initialized. Therefore, when an attempt is made in line 7 to copy this pointer to b, an error is generated.


	1: 	/*
	2:	 * File: copyunin.C
	3:	 */
	4:	int main() {
	5:		char *a, *b;
	6:
	7:		b = a; bug
	8:		return 0;
	9:	}

Diagnosis (at runtime)


1.	[copyunin.C:7] **COPY_UNINIT_PTR**
	>> 		b = a;
	
2.		Copying uninitialized pointer: a
	
3.		Stack trace where the error occurred:
					main()	copyunin.C, 7


  1. Source line at which the problem was detected.
  2. Brief description of the problem.
  3. Stack trace showing the function call sequence leading to the error.

Repair

This problem is usually caused by omitting an assignment or allocation statement that would initialize a pointer. The example code given could be corrected by assigning a value to a before reaching line 7.


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