Click here to Skip to main content
15,941,293 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionNewline as <<ALT + ENTER>> in PreTranslateMessage for MultilineEdit Control Pin
Vishal_K897-Mar-11 0:13
Vishal_K897-Mar-11 0:13 
AnswerRe: Newline as > in PreTranslateMessage for MultilineEdit Control Pin
Cool_Dev7-Mar-11 2:07
Cool_Dev7-Mar-11 2:07 
Questionwrite a C program to find the area and perimeter of a circle? Pin
valyvachouama3-Mar-11 5:54
valyvachouama3-Mar-11 5:54 
AnswerRe: write a C program to find the area and perimeter of a circle? Pin
_AnsHUMAN_ 3-Mar-11 19:18
_AnsHUMAN_ 3-Mar-11 19:18 
GeneralRe: write a C program to find the area and perimeter of a circle? Pin
valyvachouama3-Mar-11 20:32
valyvachouama3-Mar-11 20:32 
GeneralRe: write a C program to find the area and perimeter of a circle? Pin
Richard MacCutchan3-Mar-11 22:11
mveRichard MacCutchan3-Mar-11 22:11 
AnswerRe: write a C program to find the area and perimeter of a circle? Pin
Stephen Hewitt4-Mar-11 17:03
Stephen Hewitt4-Mar-11 17:03 
Questionfreeing pointers in pointer array causes SegFault [solved] Pin
Jordanwb27-Feb-11 9:03
Jordanwb27-Feb-11 9:03 
Hello. I have the following code block:

#include <stdlib.h>

typedef struct List_s
{
	int count;
	void **items;
} List;

List *list_create()
{
	List *list = malloc (sizeof (List));
	list->count = 0;
	list->items = malloc (1 * sizeof (void *));
	
	return list;
}

void list_add (List *list, void *item)
{
	list->items = realloc (list->items, (list->count + 1) * sizeof (void *));
	list->items[list->count] = item;
	list->count++;
}

void list_dealloc (List *list)
{
	for (int i = 0; i < list->count; i++)
	{
		free (list->items[i]);
	}
	
	free (list->items);
	free (list);
}


When I pass a List to list_dealloc I get a segmentation fault on the line in the for loop. I can print the contents of items[i] just fine (in my test case it's the string "Hello"). I'm using gcc-4.5.1 on 64 bit Fedora 14 if that's anything useful.

modified on Monday, February 28, 2011 12:57 PM

AnswerRe: freeing pointers in pointer array causes SegFault Pin
Cool_Dev27-Feb-11 19:06
Cool_Dev27-Feb-11 19:06 
AnswerRe: freeing pointers in pointer array causes SegFault Pin
Richard MacCutchan27-Feb-11 23:01
mveRichard MacCutchan27-Feb-11 23:01 
GeneralRe: freeing pointers in pointer array causes SegFault Pin
Jordanwb28-Feb-11 4:18
Jordanwb28-Feb-11 4:18 
GeneralRe: freeing pointers in pointer array causes SegFault Pin
Richard MacCutchan28-Feb-11 6:10
mveRichard MacCutchan28-Feb-11 6:10 
GeneralRe: freeing pointers in pointer array causes SegFault Pin
Jordanwb28-Feb-11 6:57
Jordanwb28-Feb-11 6:57 
QuestionMAPI: MapiRecipDesc is not properly working with Lotus Notes (ver8.5) [modified] Pin
vinvino200122-Feb-11 2:55
vinvino200122-Feb-11 2:55 
AnswerRe: MAPI: MapiRecipDesc is not properly working with Lotus Notes (ver8.5) Pin
vinvino200123-Feb-11 20:17
vinvino200123-Feb-11 20:17 
QuestionFunction pointer syntax help Pin
Xpnctoc19-Feb-11 17:38
Xpnctoc19-Feb-11 17:38 
AnswerRe: Function pointer syntax help Pin
Alain Rist19-Feb-11 20:19
Alain Rist19-Feb-11 20:19 
GeneralRe: Function pointer syntax help Pin
Xpnctoc20-Feb-11 10:15
Xpnctoc20-Feb-11 10:15 
AnswerRe: Function pointer syntax help Pin
Yusuf20-Feb-11 1:45
Yusuf20-Feb-11 1:45 
AnswerSOLVED: Re: Function pointer syntax help Pin
Xpnctoc20-Feb-11 10:29
Xpnctoc20-Feb-11 10:29 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Albert Holguin20-Feb-11 11:26
professionalAlbert Holguin20-Feb-11 11:26 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Xpnctoc20-Feb-11 12:36
Xpnctoc20-Feb-11 12:36 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Michael Dunn20-Feb-11 21:43
sitebuilderMichael Dunn20-Feb-11 21:43 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Xpnctoc21-Feb-11 4:15
Xpnctoc21-Feb-11 4:15 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Albert Holguin21-Feb-11 10:51
professionalAlbert Holguin21-Feb-11 10:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.