glibc error


 
Thread Tools Search this Thread
Top Forums Programming glibc error
# 1  
Old 05-06-2008
glibc error

Hi All,

This is my first time posting on this forum. I'd like to
participate actively on this list.

Here we go!

I'm making a little application and I'm using ncurses. After a while
using it, I receive the following error and the stack trace is shown:

***glibc detected*** malloc() : memory corruption

Anybody knows when glibc throws this error??

I'll appreciate your help!

Thanks in advance!
# 2  
Old 05-06-2008
malloc is complaining that you have corrupted a pointer in some way example:
Code:
char *ptr=malloc(100);
char tmp[10={0x0};
..........
.......
ptr++;
............
..........
free(ptr);

The error happens on a realloc or a free because the pointer no longer references the same start of memory. You can get the same result by writing, say, 15 characters into the tmp string, so that you overwrote the string and changed the memory value stored in ptr.
# 3  
Old 05-07-2008
Hi jim,

Thanks a lot for your answer, I'll re-check my code in order to find when malloc is trying to free up an incorrect memory address.
If I can't find the error, I'll post my code, because the error is thrown by a function of ncurses library. I think I'm passing a bad argument to this function.

Thank again!
# 4  
Old 05-07-2008
try add -Wall to your compile statement
# 5  
Old 05-07-2008
Hi

Thanks frank, but I already have the -Wall flag in the Makefile.
Thaks!
# 6  
Old 05-07-2008
There is also electric fence which can find buffer overruns for you.
# 7  
Old 05-07-2008
Thanks

I've never used that kind of tool, but I'll try to use it in my application in order to find out what's happening.

Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

FORTRAN error *** glibc detected ***

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I'm doing aproximation of derivative called five-point stencil. For every value of x, in interval , in step... (0 Replies)
Discussion started by: antonija
0 Replies

2. UNIX and Linux Applications

Install glibc-debug for glibc-2.11.3-17.31.1 on SLES 11

I have to debug a function getopt_long in glibc-2.11.3-17.31.1. For that how can I download and install its corresponding glibc-debug on SLES 11? (8 Replies)
Discussion started by: rupeshkp728
8 Replies

3. UNIX for Dummies Questions & Answers

Error while installing glibc 2.16.0 on ubuntu 12.04 LTS

I come across the following error while configuring glibc 2.16.0 on ubuntu 12.04 LTS:"These critical programs are missing or too old: ld". Please suggest me a solution for the same at the earliest. (1 Reply)
Discussion started by: nov_2012
1 Replies

4. UNIX for Dummies Questions & Answers

How to switch to a certain version of glibc?

Hello, I currently have glibc 2.13. I was wondering if you could teach me how to switch to : glibc2.3.2 I would really appreciate it if you tell me how to do it step by step since I am a beginner . thanks. (1 Reply)
Discussion started by: alireza6485
1 Replies

5. UNIX for Advanced & Expert Users

got error when install glibc

hi all, i am play LFS recently. but i can not go on for a an error when install glibc. here is the error log: if test -r /usr/include/gnu/stubs-32.h && cmp -s /mnt/lfs/sources/glibc-build/stubs.h /usr/include/gnu/stubs-32.h; \ then echo 'stubs.h unchanged'; \ else /usr/bin/install -c... (1 Reply)
Discussion started by: arnold.king
1 Replies

6. Programming

"GLIBC detected Error" for a simple C code.

Here is a simple program to find the vowels in the string. Output is fine. But I'm getting GLIBC detected as shown below : :eek: *** glibc detected *** ./VOWELS: free(): invalid pointer: 0x08b82013 *** ======= Backtrace: ========= /lib/libc.so.6 /lib/libc.so.6(cfree+0x59) ./VOWELS... (5 Replies)
Discussion started by: Ranji Raj
5 Replies

7. Ubuntu

glibc version

I need glibc version 2.2 - 2.11 for a installation. but i got glibc 2.0-2.1 from software centre... what to do? can u help? (8 Replies)
Discussion started by: paramad
8 Replies

8. UNIX for Dummies Questions & Answers

message about glibc

Hi I have a strange phenomenon on putty session connected to RHEL4 server. My session is active but without any activity for 2 or 3 hours and suddenly this message appears on the prompt : $ *** glibc detected *** free(): invalid pointer: 0xb66e0d50 *** Could you have an idea about it ? (2 Replies)
Discussion started by: madmat
2 Replies

9. UNIX for Advanced & Expert Users

install glibc-2.6.1

Hi, I have downloaded glibc-2.6.1.tar.tar. But I do not know how to install it on Xubuntu. Do you know ? Thank you. (4 Replies)
Discussion started by: big123456
4 Replies

10. UNIX for Dummies Questions & Answers

glibc 2.2.2

After installing glibc 2.2.2 on my redhat 6.1 (with all necessary updates). I try to restart but my compter say i do not existst like you deleted root account and you are root. (i have seen people doing that ;-P ). I run configure with these command --bindir=/bin --sbindir=/sbin --libdir=/lib... (1 Reply)
Discussion started by: jurrien
1 Replies
Login or Register to Ask a Question