Re: [cc65] Why crashing attempting to free this struct?

From: Payton Byrd <plbyrd1gmail.com>
Date: 2012-03-25 03:09:29
On Sat, Mar 24, 2012 at 8:07 PM, Christopher Pow <
christopher.s.pow@gmail.com> wrote:

> > I get a CPU jam whenever I attempt to free an instance of
> > DirectoryListReuBlock.  I've got no idea what's causing this, but they
> have
> > to be freed or I'll have memory leaks galore.
>
> Probably would have to see more of the code to be able to help...
>

Here's the code for instantiating an instance of the struct:


directory_list_reu_block_t * constructDirectoryListReuBlock()
{
	directory_list_reu_block_t *result = (directory_list_reu_block_t
*)malloc(sizeof(directory_list_reu_block_t));


	//log("Constructing Directory List REU Block.");
	result->block = 0;
	result->next = 0;
	result->previous = 0;
	memset(result->nodes[0].cbmDirectoryEntry.name, 0, 17);

	memset(result->nodes[1].cbmDirectoryEntry.name, 0, 17);
	memset(result->nodes[2].cbmDirectoryEntry.name, 0, 17);
	memset(result->nodes[3].cbmDirectoryEntry.name, 0, 17);
	memset(result->nodes[4].cbmDirectoryEntry.name, 0, 17);

	memset(result->nodes[5].cbmDirectoryEntry.name, 0, 17);
	memset(result->nodes[6].cbmDirectoryEntry.name, 0, 17);
	memset(result->nodes[7].cbmDirectoryEntry.name, 0, 17);
	memset(result->nodes[8].cbmDirectoryEntry.name, 0, 17);

	memset(result->nodes[9].cbmDirectoryEntry.name, 0, 17);
	memset(result->nodes[0].screenCodesName, 32, 17);
	memset(result->nodes[1].screenCodesName, 32, 17);
	memset(result->nodes[2].screenCodesName, 32, 17);

	memset(result->nodes[3].screenCodesName, 32, 17);
	memset(result->nodes[4].screenCodesName, 32, 17);
	memset(result->nodes[5].screenCodesName, 32, 17);
	memset(result->nodes[6].screenCodesName, 32, 17);

	memset(result->nodes[7].screenCodesName, 32, 17);
	memset(result->nodes[8].screenCodesName, 32, 17);
	memset(result->nodes[9].screenCodesName, 32, 17);
	//log("Constructed Directory List REU Block.");

}

-- 
Payton Byrd
<http://www.paytonbyrd.com>
<http://it.toolbox.com/blogs/paytonbyrd>

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Mar 25 03:10:01 2012

This archive was generated by hypermail 2.1.8 : 2012-03-25 03:10:04 CEST