A
Alberto
Hi there!
I'm currently handling with a Valgrind error in a binary mode write of
date. The error is the following:
==6877== Syscall param writev(vector[...]) points to uninitialised
byte(s)
==6877== at 0x4236C61: writev (writev.c:51)
==6877== by 0x40F2909: std::__basic_file<char>::xsputn_2(char const*,
int, char const*, int) (in /usr/lib/libstdc++.so.6.0.13)
lib/libstdc++.so.6.0.13)
==6877== by 0x804A68F: convert_struct_to_binary(tNodo*&,
std::basic_ofstream<char, std::char_traits<char> >&) (libplanet.cc:
674)
==6877== by 0x804C5D4: GuardarBinario(tNodo*&) (libplanet.cc:1214)
==6877== by 0x80500B0: main (planet.cc:66)
==6877== Address 0x4353a1e is 110 bytes inside a block of size 8,192
alloc´d
==6877== at 0x4025024: operator new[](unsigned int)
(vg_replace_malloc.c:258)
==6877== by 0x40A1855: std::basic_ofstream<char,
std::char_traits<char> >:pen(char const*, std::_Ios_Openmode) (in /
usr/lib/libstdc++.so.6.0.13)
==6877== by 0x804C51D: GuardarBinario(tNodo*&) (libplanet.cc:1202)
==6877== by 0x80500B0: main (planet.cc:66)
==6877==
==6877== Syscall param write(buf) points to uninitialised byte(s)
==6877== at 0x422F113: __write_nocancel (in /lib/tls/i686/cmov/
libc-2.10.1.so)
std::char_traits<char> >::~basic_ofstream() (in /usr/lib/libstdc++.so.
6.0.13)
==6877== by 0x804C652: GuardarBinario(tNodo*&) (libplanet.cc:1222)
==6877== by 0x80500B0: main (planet.cc:66)
==6877== Address 0x4353a1e is 110 bytes inside a block of size 8,192
alloc´d
==6877== at 0x4025024: operator new[](unsigned int)
(vg_replace_malloc.c:258)
==6877== by 0x40A1855: std::basic_ofstream<char,
std::char_traits<char> >:pen(char const*, std::_Ios_Openmode) (in /
usr/lib/libstdc++.so.6.0.13)
==6877== by 0x804C51D: GuardarBinario(tNodo*&) (libplanet.cc:1202)
==6877== by 0x80500B0: main (planet.cc:66)
It happens when I try to write binary data into the file. I've been
searching all over the internet for this error, but I haven't found
nothing useful. I think it is because in the struct that is to be
written:
fileb.write((const char *)&(pos_binary), sizeof(pos_binary));
There are some junk data initialized. That's the more arguable option.
But I think everything in the program is right. At the end there is no
memory leaks or something like that.
The basic function for creating nodes on the list is this:
bool CrearNodoVacio(pNodo &n)
{
bool status = false;
n = new Nodo;
if (n != NULL)
{
n->pSig = NULL;
status = true;
}
return status;
}
As you see, very simple.
Thank you very much in advance!
I'm currently handling with a Valgrind error in a binary mode write of
date. The error is the following:
==6877== Syscall param writev(vector[...]) points to uninitialised
byte(s)
==6877== at 0x4236C61: writev (writev.c:51)
==6877== by 0x40F2909: std::__basic_file<char>::xsputn_2(char const*,
int, char const*, int) (in /usr/lib/libstdc++.so.6.0.13)
==6877== by 0x40C9CB0: std:stream::write(char const*, int) (in /usr/==6877== by 0x409E059: std::basic_filebuf said:::xsputn(char const*, int) (in /usr/lib/libstdc++.so.6.0.13)
lib/libstdc++.so.6.0.13)
==6877== by 0x804A68F: convert_struct_to_binary(tNodo*&,
std::basic_ofstream<char, std::char_traits<char> >&) (libplanet.cc:
674)
==6877== by 0x804C5D4: GuardarBinario(tNodo*&) (libplanet.cc:1214)
==6877== by 0x80500B0: main (planet.cc:66)
==6877== Address 0x4353a1e is 110 bytes inside a block of size 8,192
alloc´d
==6877== at 0x4025024: operator new[](unsigned int)
(vg_replace_malloc.c:258)
==6877== by 0x409D592: std::basic_filebuf said:::_M_allocate_internal_buffer() (in /usr/lib/libstdc++.so.6.0.13)
6.0.13)==6877== by 0x40A15B1: std::basic_filebuf said::pen(char const*, std::_Ios_Openmode) (in /usr/lib/libstdc++.so.
==6877== by 0x40A1855: std::basic_ofstream<char,
std::char_traits<char> >:pen(char const*, std::_Ios_Openmode) (in /
usr/lib/libstdc++.so.6.0.13)
==6877== by 0x804C51D: GuardarBinario(tNodo*&) (libplanet.cc:1202)
==6877== by 0x80500B0: main (planet.cc:66)
==6877==
==6877== Syscall param write(buf) points to uninitialised byte(s)
==6877== at 0x422F113: __write_nocancel (in /lib/tls/i686/cmov/
libc-2.10.1.so)
6.0.13)==6877== by 0x409DDCD: std::basic_filebuf said:::_M_convert_to_external(char*, int) (in /usr/lib/libstdc++.so.
==6877== by 0x409DF0E: std::basic_filebuf said::verflow(int) (in /usr/lib/libstdc++.so.6.0.13)
==6877== by 0x40A0E07: std::basic_filebuf said:::_M_terminate_output() (in /usr/lib/libstdc++.so.6.0.13)
==6877== by 0x40A4C67: std::basic_ofstream<char,==6877== by 0x40A1417: std::basic_filebuf said:::close() (in /usr/lib/libstdc++.so.6.0.13)
std::char_traits<char> >::~basic_ofstream() (in /usr/lib/libstdc++.so.
6.0.13)
==6877== by 0x804C652: GuardarBinario(tNodo*&) (libplanet.cc:1222)
==6877== by 0x80500B0: main (planet.cc:66)
==6877== Address 0x4353a1e is 110 bytes inside a block of size 8,192
alloc´d
==6877== at 0x4025024: operator new[](unsigned int)
(vg_replace_malloc.c:258)
==6877== by 0x409D592: std::basic_filebuf said:::_M_allocate_internal_buffer() (in /usr/lib/libstdc++.so.6.0.13)
6.0.13)==6877== by 0x40A15B1: std::basic_filebuf said::pen(char const*, std::_Ios_Openmode) (in /usr/lib/libstdc++.so.
==6877== by 0x40A1855: std::basic_ofstream<char,
std::char_traits<char> >:pen(char const*, std::_Ios_Openmode) (in /
usr/lib/libstdc++.so.6.0.13)
==6877== by 0x804C51D: GuardarBinario(tNodo*&) (libplanet.cc:1202)
==6877== by 0x80500B0: main (planet.cc:66)
It happens when I try to write binary data into the file. I've been
searching all over the internet for this error, but I haven't found
nothing useful. I think it is because in the struct that is to be
written:
fileb.write((const char *)&(pos_binary), sizeof(pos_binary));
There are some junk data initialized. That's the more arguable option.
But I think everything in the program is right. At the end there is no
memory leaks or something like that.
The basic function for creating nodes on the list is this:
bool CrearNodoVacio(pNodo &n)
{
bool status = false;
n = new Nodo;
if (n != NULL)
{
n->pSig = NULL;
status = true;
}
return status;
}
As you see, very simple.
Thank you very much in advance!