On 16/12/11 09:35, Hannu Vuolasaho wrote: > I'm using Arch Linux and found old bug about strlen and SSE instructions > among other thing. Also there was some posts about stripped libc and I have: > $ file /lib/libc-2.14.1.so > /lib/libc-2.14.1.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), > dynamically linked (uses shared libs), > BuildID[sha1]=0x84c4a5b908da76082cff58f393bee5d9c15d9684, for GNU/Linux > 2.6.27, stripped > > Does that have something to do with puts() error? > > #include<stdio.h> > #include<stdlib.h> > #include<string.h> > > int main(){ > char * buffer = NULL; > size_t size = 0; > int len = 0; > if(getline(&buffer,&size, stdin)>0&& buffer != NULL ){ > if(strlen(buffer)> 0){ > fputs(buffer, stdout); > } > } > if(buffer != NULL){ > free(buffer); > } > }
That works fine for me: ==30413== Memcheck, a memory error detector ==30413== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==30413== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==30413== Command: ./xxx ==30413== foo foo ==30413== ==30413== HEAP SUMMARY: ==30413== in use at exit: 0 bytes in 0 blocks ==30413== total heap usage: 1 allocs, 1 frees, 120 bytes allocated ==30413== ==30413== All heap blocks were freed -- no leaks are possible ==30413== ==30413== For counts of detected and suppressed errors, rerun with: -v ==30413== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2) Tom -- Tom Hughes (t...@compton.nu) http://compton.nu/ ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users