Re: [Vala] Error in `./gtk_foobar_sample': double free or corruption (!prev)
- From: Nadav Vinik <nadavvin gmail com>
- To: vala-list gnome org
- Subject: Re: [Vala] Error in `./gtk_foobar_sample': double free or corruption (!prev)
- Date: Fri, 21 Jun 2013 00:16:37 +0300
Please look at:
http://thread.gmane.org/gmane.network.tcpdump.devel/6389/focus=6395
What are you suggest?
thanks
nadav
On 20 June 2013 10:17, Nadav Vinik <nadavvin gmail com> wrote:
I found the problem of the double free.
bold lines are my changes.
if I put in comment the first row in bold or "_pcap_close0 (cap)" before
the next bold line its work.
"*handle is null"* is printed only if the first row in bold is in comment.
1) why g_free free "_tmp16_" (cap) ?
2) what g_free put in cap which is free but not NULL?
#define _pcap_close0(var) ((var == NULL) ? NULL : (var = (pcap_close
(var), NULL)))
tmp18_ = pcap_next (_tmp16_, &_tmp17_);
(&header);
header = _tmp17_;
_tmp19_ = _tmp18_;
_tmp19__length1 = -1;
*//_tmp19_ = (g_free (_tmp19_), NULL);*
_tmp20_ = stdout;
_tmp21_ = header;
_tmp22_ = _tmp21_.len;
fprintf (_tmp20_, "Got packet caplen = %d\n", (gint) _tmp22_);
result = 0;
_pcap_close0 (cap);
*printf("_pcap_close in 157\n");*
*if(cap == NULL ) {
printf("handle is null\n");
}*
_g_free0 (dev);
errbuf = (g_free (errbuf), NULL);
(&header);
packet = (g_free (packet), NULL);
return result;
}
On 19 June 2013 22:03, Nadav Vinik <nadavvin gmail com> wrote:
Hello
I got this error only if cap.next catch packet with len more then zero:
/*packet = */cap.next(out header);
stdout.printf("Got packet caplen = %d\n", header.len);
I convert the code from "a.c" which it run well there.
taken from:
http://www.tcpdump.org/pcap.html
pcap vapi taken from:
https://github.com/apmasell/vapis/blob/master/libpcap.vapi
Vala 0.20.1
Thanks
Nadav
$ sudo ./gtk_foobar_sample
Got packet caplen = 90
*** Error in `./gtk_foobar_sample': double free or corruption (!prev):
0x00000000018e4370 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80a46)[0x7f85cd0d6a46]
/usr/lib/x86_64-linux-gnu/libpcap.so.0.8(+0x696a)[0x7f85cd42496a]
/usr/lib/x86_64-linux-gnu/libpcap.so.0.8(pcap_close+0x1e)[0x7f85cd42b2fe]
./gtk_foobar_sample(main+0xd5)[0x4012f5]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f85cd077ea5]
./gtk_foobar_sample[0x40139d]
======= Memory map: ========
00400000-00403000 r-xp 00000000 08:0b 13320688
/media/debian-home/nadav3/tmp/gtk-foobar-sample/src/gtk_foobar_sample
00602000-00603000 r--p 00002000 08:0b 13320688
/media/debian-home/nadav3/tmp/gtk-foobar-sample/src/gtk_foobar_sample
00603000-00604000 rw-p 00003000 08:0b 13320688
/media/debian-home/nadav3/tmp/gtk-foobar-sample/src/gtk_foobar_sample
018d9000-018fa000 rw-p 00000000 00:00 0
[heap]
7f85cc7dc000-7f85cc7f0000 r-xp 00000000 08:01 1202110
/lib/x86_64-linux-gnu/libgcc_s.so.1
7f85cc7f0000-7f85cc9f0000 ---p 00014000 08:01 1202110
/lib/x86_64-linux-gnu/libgcc_s.so.1
7f85cc9f0000-7f85cc9f1000 r--p 00014000 08:01 1202110
/lib/x86_64-linux-gnu/libgcc_s.so.1
7f85cc9f1000-7f85cc9f2000 rw-p 00015000 08:01 1202110
/lib/x86_64-linux-gnu/libgcc_s.so.1
7f85cc9f2000-7f85cca0a000 r-xp 00000000 08:01 1202290
/lib/x86_64-linux-gnu/libpthread-2.17.so
7f85cca0a000-7f85ccc09000 ---p 00018000 08:01 1202290
/lib/x86_64-linux-gnu/libpthread-2.17.so
7f85ccc09000-7f85ccc0a000 r--p 00017000 08:01 1202290
/lib/x86_64-linux-gnu/libpthread-2.17.so
7f85ccc0a000-7f85ccc0b000 rw-p 00018000 08:01 1202290
/lib/x86_64-linux-gnu/libpthread-2.17.so
7f85ccc0b000-7f85ccc0f000 rw-p 00000000 00:00 0
7f85ccc0f000-7f85ccc4c000 r-xp 00000000 08:01 1202713
/lib/x86_64-linux-gnu/libpcre.so.3.13.1
7f85ccc4c000-7f85cce4c000 ---p 0003d000 08:01 1202713
/lib/x86_64-linux-gnu/libpcre.so.3.13.1
7f85cce4c000-7f85cce4d000 r--p 0003d000 08:01 1202713
/lib/x86_64-linux-gnu/libpcre.so.3.13.1
7f85cce4d000-7f85cce4e000 rw-p 0003e000 08:01 1202713
/lib/x86_64-linux-gnu/libpcre.so.3.13.1
7f85cce4e000-7f85cce55000 r-xp 00000000 08:01 360731
/usr/lib/x86_64-linux-gnu/libffi.so.6.0.1
7f85cce55000-7f85cd054000 ---p 00007000 08:01 360731
/usr/lib/x86_64-linux-gnu/libffi.so.6.0.1
7f85cd054000-7f85cd055000 r--p 00006000 08:01 360731
/usr/lib/x86_64-linux-gnu/libffi.so.6.0.1
7f85cd055000-7f85cd056000 rw-p 00007000 08:01 360731
/usr/lib/x86_64-linux-gnu/libffi.so.6.0.1
7f85cd056000-7f85cd214000 r-xp 00000000 08:01 1202232
/lib/x86_64-linux-gnu/libc-2.17.so
7f85cd214000-7f85cd413000 ---p 001be000 08:01 1202232
/lib/x86_64-linux-gnu/libc-2.17.so
7f85cd413000-7f85cd417000 r--p 001bd000 08:01 1202232
/lib/x86_64-linux-gnu/libc-2.17.so
7f85cd417000-7f85cd419000 rw-p 001c1000 08:01 1202232
/lib/x86_64-linux-gnu/libc-2.17.so
7f85cd419000-7f85cd41e000 rw-p 00000000 00:00 0
7f85cd41e000-7f85cd455000 r-xp 00000000 08:01 102383
/usr/lib/x86_64-linux-gnu/libpcap.so.1.3.0
7f85cd455000-7f85cd654000 ---p 00037000 08:01 102383
/usr/lib/x86_64-linux-gnu/libpcap.so.1.3.0
7f85cd654000-7f85cd656000 r--p 00036000 08:01 102383
/usr/lib/x86_64-linux-gnu/libpcap.so.1.3.0
7f85cd656000-7f85cd657000 rw-p 00038000 08:01 102383
/usr/lib/x86_64-linux-gnu/libpcap.so.1.3.0
7f85cd657000-7f85cd658000 rw-p 00000000 00:00 0
7f85cd658000-7f85cd751000 r-xp 00000000 08:01 1201960
/lib/x86_64-linux-gnu/libglib-2.0.so.0.3600.0
7f85cd751000-7f85cd951000 ---p 000f9000 08:01 1201960
/lib/x86_64-linux-gnu/libglib-2.0.so.0.3600.0
7f85cd951000-7f85cd952000 r--p 000f9000 08:01 1201960
/lib/x86_64-linux-gnu/libglib-2.0.so.0.3600.0
7f85cd952000-7f85cd953000 rw-p 000fa000 08:01 1201960
/lib/x86_64-linux-gnu/libglib-2.0.so.0.3600.0
7f85cd953000-7f85cd954000 rw-p 00000000 00:00 0
7f85cd954000-7f85cd9a1000 r-xp 00000000 08:01 359889
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.3600.0
7f85cd9a1000-7f85cdba1000 ---p 0004d000 08:01 359889
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.3600.0
7f85cdba1000-7f85cdba2000 r--p 0004d000 08:01 359889
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.3600.0
7f85cdba2000-7f85cdba3000 rw-p 0004e000 08:01 359889
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.3600.0
7f85cdba3000-7f85cdbc6000 r-xp 00000000 08:01 1202124
/lib/x86_64-linux-gnu/ld-2.17.so
7f85cdd8b000-7f85cdd90000 rw-p 00000000 00:00 0
7f85cddc1000-7f85cddc5000 rw-p 00000000 00:00 0
7f85cddc5000-7f85cddc6000 r--p 00022000 08:01 1202124
/lib/x86_64-linux-gnu/ld-2.17.so
7f85cddc6000-7f85cddc8000 rw-p 00023000 08:01 1202124
/lib/x86_64-linux-gnu/ld-2.17.so
7fffbe772000-7fffbe793000 rw-p 00000000 00:00 0
[stack]
7fffbe7fe000-7fffbe800000 r-xp 00000000 00:00 0
[vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
--
הבלוג שלי:
http://nadavvin.com
--
הבלוג שלי:
http://nadavvin.com
--
הבלוג שלי:
http://nadavvin.com
--
הבלוג שלי:
http://nadavvin.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]