|
From: | Anil Motilal Mahtani Mirchandani |
Subject: | [Bug-readline] Readline memory leak |
Date: | Mon, 17 May 2010 11:47:21 +0100 |
#include <stdlib.h>
#include <readline/readline.h>
int main()
{
char *buf;
while((buf = readline("Hello: "))!=NULL) {
if(strcmp(buf,"exit") == 0){
free(buf);
break;
}
free(buf);
}
return 0;
}
==9958== Memcheck, a memory error detector
==9958== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==9958== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==9958== Command: ./READY
==9958==
Hellol: exit
==9958==
==9958== HEAP SUMMARY:
==9958== in use at exit: 42,911 bytes in 154 blocks
==9958== total heap usage: 285 allocs, 131 frees, 58,543 bytes allocated
==9958==
==9958== LEAK SUMMARY:
==9958== definitely lost: 0 bytes in 0 blocks
==9958== indirectly lost: 0 bytes in 0 blocks
==9958== possibly lost: 0 bytes in 0 blocks
==9958== still reachable: 42,911 bytes in 154 blocks
==9958== suppressed: 0 bytes in 0 blocks
==9958== Rerun with --leak-check=full to see details of leaked memory
==9958==
==9958== For counts of detected and suppressed errors, rerun with: -v
==9958== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 13 from 8)
[Prev in Thread] | Current Thread | [Next in Thread] |