Reference to freed resource

From Appmethod Topics
Jump to: navigation, search

Go Up to CodeGuard Errors Index

The Reference To Freed Resource error occurs if you attempt to free a resource twice. There are several ways to create this error; the following code demonstrates one:

#include <tchar.h>
#pragma hdrstop
class someclass{
	int fnumber;
	int getnumber(){return fnumber;}
	void setnumber(int nw){fnumber = nw;}
	int doublev(int val){return val*2;}
	int publicalval;


void myf()
  someclass *myc = new someclass[10];
  delete[] myc;
  delete[] myc;

int _tmain(int argc, _TCHAR* argv[])
	return 0;