Sponsored Content
Top Forums Programming "GLIBC detected Error" for a simple C code. Post 302524973 by Ranji Raj on Wednesday 25th of May 2011 08:34:42 AM
Old 05-25-2011
"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 : Smilie

Code:
*** glibc detected *** ./VOWELS: free(): invalid pointer: 0x08b82013 ***
======= Backtrace: =========
/lib/libc.so.6[0x1a86c5]
/lib/libc.so.6(cfree+0x59)[0x1a8b09]
./VOWELS[0x804859d]
/lib/libc.so.6(__libc_start_main+0xdc)[0x154e9c]
./VOWELS[0x80483b1]
======= Memory map: ========
0011b000-00136000 r-xp 00000000 08:03 2913187    /lib/ld-2.5.so
00136000-00137000 r-xp 0001a000 08:03 2913187    /lib/ld-2.5.so
00137000-00138000 rwxp 0001b000 08:03 2913187    /lib/ld-2.5.so
0013f000-00292000 r-xp 00000000 08:03 2913207    /lib/libc-2.5.so
00292000-00294000 r-xp 00153000 08:03 2913207    /lib/libc-2.5.so
00294000-00295000 rwxp 00155000 08:03 2913207    /lib/libc-2.5.so
00295000-00298000 rwxp 00295000 00:00 0 
0054d000-00558000 r-xp 00000000 08:03 2913221    /lib/libgcc_s-4.1.2-20080825.so.1
00558000-00559000 rwxp 0000a000 08:03 2913221    /lib/libgcc_s-4.1.2-20080825.so.1
00bdf000-00be0000 r-xp 00bdf000 00:00 0          [vdso]
08048000-08049000 r-xp 00000000 08:03 1275582    /home/ranjith/Cs/VOWELS
08049000-0804a000 rw-p 00000000 08:03 1275582    /home/ranjith/Cs/VOWELS
08b82000-08ba3000 rw-p 08b82000 00:00 0          [heap]
b7fbf000-b7fc1000 rw-p b7fbf000 00:00 0 
b7fdc000-b7fde000 rw-p b7fdc000 00:00 0 
bff5d000-bff72000 rw-p bffe9000 00:00 0          [stack]
Aborted


CODE:

Code:
int a,e,i,o,u,non;
int main()
{       char *input=(char*)malloc(160);
        printf("Enter a String of any lenngth...\n");
        scanf("%s",input);
        while(*input != '\0'){
                switch(*input)
                {
                        case 'a': a++;break;
                        case 'e': e++;break;
                        case 'i': i++;break;
                        case 'o': o++;break;
                        case 'u': u++;break;
                        default : non++;break;
                }
                input++;
        }
        printf("Vowels list appeared as below:\n");
        printf("\tA\tE\tI\tO\tU\tNON-VOWLES\n");
        printf("%8d%8d%8d%8d%8d%8d\n",a,e,i,o,u,non);
        free(input);    
}

I'm freeing the char pointer well after its use only. Why Am I getting this error(INVALID POINTER). Please let me know.

Last edited by pludi; 05-25-2011 at 10:01 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. HP-UX

ERROR: more than one instance of overloaded function "vprintf" has "C" linkage

Hi people! I've got this own library: -------------------------------------------- Personal.h -------------------------------------------- #ifdef __cplusplus extern "C" { #endif #include <stdio.h> #include <stdarg.h> #include <string.h> ... (0 Replies)
Discussion started by: donatoll
0 Replies

3. Shell Programming and Scripting

Very Simple "Tabs to Newline" Code???

hi people; i have a text, iptables.txt and values are as follows inside: (seperators are TAB) 10.15.2.2 2 40 10.15.3.3 1 10 10.32.2.1 3 40 10.33.6.7 2 50 10.16.3.2 1 60 10.11.3.9 1 20 10.19.2.1 1 80 10.16.9.9 3 20 10.29.7.9 2 90 10.33.2.7 3 40 ...... i... (5 Replies)
Discussion started by: gc_sw
5 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

6. Shell Programming and Scripting

Help with delete "_" once detected from the end of a content

Input file: matrix-remodelling_associated_8____ aurora_interacting_1___ L20 von_factor_A_domain_1 ATP_containing_3B_ Desired output: matrix-remodelling_associated_8 aurora_interacting_1 L20 von_factor_A_domain_1 ATP_containing_3B I wanna delete/remove all the "_" that appears at... (2 Replies)
Discussion started by: perl_beginner
2 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. 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

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
pam_stack(8)						   System Administrator's Manual					      pam_stack(8)

NAME
pam_stack - recurse into other PAM stacks SYNOPSIS
auth required /lib/security/pam_stack.so service=foo session optional /lib/security/pam_stack.so service=foo password optional /lib/security/pam_stack.so service=foo account optional /lib/security/pam_stack.so service=foo DESCRIPTION
In a nutshell, pam_stack lets you "call", from inside of the stack for a particular service, the stack defined for any another service. The intention is to allow multiple services to "include" a system-wide setup, so that when that setup needs to be changed, it need only be changed in one place. ARGUMENTS
debug turns on debugging via syslog(3). service=name tells pam_stack.so to execute the stack defined for the service name, which will usually be another file in /etc/pam.d. EXAMPLE
/etc/pam.d/imap: auth required /lib/security/pam_stack.so service=system-auth auth required /lib/security/pam_shells.so /etc/pam.d/system-auth: auth sufficient /lib/security/pam_krb5.so auth sufficient /lib/security/pam_unix.so shadow nullok auth required /lib/security/pam_deny.so CAVEAT
Because recursion is fully supported, there is potential to really break things by having a stack call itself either directly or via mutual recursion. BUGS
Let's hope not, but if you find any, please email the author. AUTHOR
Nalin Dahyabhai <nalin@redhat.com> Red Hat Linux 2001/01/30 pam_stack(8)
All times are GMT -4. The time now is 10:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy