1752730 Members
5699 Online
108789 Solutions
New Discussion юеВ

Re: Segmentation fault

 
MUFTI Rachid
Frequent Advisor

Segmentation fault

This fault is happening when calling a fonction :

Program terminated with signal 11, Segmentation fault.
#0 0x6ff3597c in _sigfillset+0x61c () from /usr/lib/libc.2
(gdb) where
#0 0x6ff3597c in _sigfillset+0x61c () from /usr/lib/libc.2
#1 0x6ff33734 in _sscanf+0x67c () from /usr/lib/libc.2
#2 0x6ff38cfc in malloc+0x18c () from /usr/lib/libc.2
#3 0x6fa75e88 in mem_malloc+0x50 ()

Best regards,

R. Mufti
3 REPLIES 3
Muthukumar_5
Honored Contributor

Re: Segmentation fault

Memoru allocation is getting failed there.
Try to analyse frame by frame as,

gdb) info f 0

zero'th frame information's will be given.

what program did you try to execute there.?

I hope your tried to get the wrong type of input with scanf() call there after memory allocation. It is good to have your code to analyse more.
Easy to suggest when don't know about the problem!
Amit Sukhija
New Member

Re: Segmentation fault

is your problem still resolved?

I am also facing the same problem. Any pointers?
Stephen Keane
Honored Contributor

Re: Segmentation fault

It would help if you could post the relevent portion of source code. One common mistake in using scanf() functions is that if the argument is say an integer you need to pass the address of where you want to store it, rather than just the name of a variable.

e.g.

int a, b, c;
int rc;
char * buffer = "1 2 3";

rc = sscanf(buffer, "%d %d %d", &a, &b, &c);

NOT

rc = sscanf(buffer, "%d %d %d", a, b, c);