LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-29-2012, 06:40 AM   #1
shruti123
LQ Newbie
 
Registered: May 2012
Posts: 2

Rep: Reputation: Disabled
valgrind Query


Hi,

valgrind shows the following log.

Invalid read of size 1

at 0x658AA7A: avmplus::String::equals(avmplus::String*) const (StringObject.cpp:186)
==2276== by 0x653037B: avmplus::AvmCore::findString(avmplus::String*) (AvmCore.cpp:3030)

My code is---

for (int32_t j = 0; j < len; j++)
{
if (str1[j] != str2[j]) ----------- crashing at this point
{
return false;
}
}

When i am checking the values at crash point in gdb its showing as

p len
$5 = 30
p j
$6 = 0
p str1[j]
$7 = 0 '\000'
p str2[j]
$8 = 72 'H'


Can anyone help me out to resolve the issue

Shruti.
 
Old 05-31-2012, 04:45 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321
your str (I do not know if str1 or str2) is not initialized properly. see: http://www.cprogramming.com/debugging/valgrind.html
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Valgrind interpretation ancou Programming 2 11-17-2010 05:15 PM
VALGRIND-Query inramana Programming 3 04-13-2010 12:41 AM
Cannot use valgrind g4j31a5 Programming 1 01-12-2007 04:24 AM
help with mysql query: return nth rows in query hawarden Programming 2 07-31-2006 06:36 PM
valgrind with C++ yashwantpinge Programming 2 02-16-2006 03:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration