LinuxQuestions.org
Visit Jeremy's Blog.
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 Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,355

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 03:50 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration