1834007 Members
1804 Online
110063 Solutions
New Discussion

Re: malloc problem

 
???_408
Occasional Contributor

malloc problem

I have a program with a promblem in malloc
My program generate core file
My system is
uname -a
HP-UX devscp1 B.10.20 U 9000/800 1815659472 unlimited-user license

Gdb say

ore was generated by `INAPB.exe'.
Program terminated with signal 11, Segmentation fault.

warning: The shared libraries were not privately mapped; setting a
breakpoint in a shared library will not work until you rerun the program.

#0 0xc009e28c in malloc () from /usr/lib/libc.1
(gdb) bt
#0 0xc009e28c in malloc () from /usr/lib/libc.1
#1 0x10d344 in libSockAllocWrQ (wrQLen=10000) at Sock_socket.c:969
..........

Sock_socket.c:969 like this

964 static SOCK_WrQType *libSockAllocWrQ(int wrQLen)
965 {
966 SOCK_WrQType *wrQPtr;
967 char **wrPool;
968
969 if(!(wrPool = (char **)malloc((wrQLen + 1) * sizeof(char *))))
970 return(NULL);

(gdb) print wrQLen
$1 = 10000

Do I need some patch with libc.1 ?


2 REPLIES 2
Laurent Menase
Honored Contributor

Re: malloc problem

Hi
This is typically a corruption caused by your code. Usually a buffer overflow.
Dennis Handly
Acclaimed Contributor

Re: malloc problem

>Laurent: This is typically a corruption caused by your code.

Exactly.

If this could be run on 11.1, you could try gdb's heap checking commands.