Sponsored Content
Full Discussion: Valgrind error
Top Forums Programming Valgrind error Post 302428705 by cyler on Thursday 10th of June 2010 02:36:14 PM
Old 06-10-2010
Valgrind error

I get this Valgrind error while using malloc but if I use calloc then there is no error.

I allocate 8 bytes for the string inside sprintf, 12 for the ip and 1 for the string terminator. This totals 21, so why is it talking about 20 bytes and 18 bytes ?

Quote:
==10228== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
==10228== at 0x4EF65B5: send (in /lib/libc-2.7.so)
==10228== by 0x4030B4: functionname (includefile.h:249)
==10228== by 0x403976: main (program.c:28)
==10228== Address 0x517d89a is 18 bytes inside a block of size 20 alloc'd
==10228== at 0x4C2260E: malloc (vg_replace_malloc.c:207)
==10228== by 0x40307C: functionname (includefile.h:247)
==10228== by 0x403976: main (program.c:28)
Partial code:

Code:
char ip[] = "80.80.80.80";
int buffer = 8 + strlen(ip); // 8 for headers fixed text
char *headers = malloc(buffer + 1);
sprintf(headers, " -r %s\r\n", ip);
send(foobar, headers, buffer, 0);

 

7 More Discussions You Might Find Interesting

1. AIX

Can Valgrind work well on AIX?

As Valgrind announced, 3.3.0 and 3.3.1 version can support AIX 5.3. But I met a block issue when I used Valgrind on AIX After installing Valgrind3.3.1 successfully on AIX5.3, I typed the following command of Valgrind: valgrind -d --tool=memcheck ls Then, the following result from Valgrind is... (0 Replies)
Discussion started by: adasong
0 Replies

2. Programming

valgrind (Conditional jump or move depends on uninitialised value(s))

Hi everybody, I wrote a small subroutine 'GetStringDelim()' to return a substring from a string enclosed by a string 'Limit1' and a char 'Limit2'. It works perfectly and I don't get an error message together with valgrind, if I set the 3rd parameter in GetStringDelim() to NULL (see below). ... (3 Replies)
Discussion started by: MIB_Maik
3 Replies

3. UNIX for Dummies Questions & Answers

valgrind Conditional jump or move depends on uninitialised value(s)

Hi, I know similar questions appeared here already, still i didnt find answer to my problem yet. Im getting the following message from valgrind (version 2): ==15414== 1 errors in context 1 of 6: ==15414== Conditional jump or move depends on uninitialised value(s) ==15414== at... (2 Replies)
Discussion started by: evasz
2 Replies

4. AIX

valgrind - pthread memory leaks on AIX

Hi all, I have written a small code just to invoke main and return immediately. When built with libpthread on AIX box, valgrind throws lots of memory leak errors. But when built without libpthread, no issues at all. Here is the sample run for your look. Any idea where I might be going wrong?... (3 Replies)
Discussion started by: visionofarun
3 Replies

5. Programming

Valgrind Error : Conditional jump or move depends on uninitialised value(s)

Hi Friends, I am using valgrind, to check errors, there are no errors in my code but this the output put i get, i need to suppress these errors, please help me do so... Conditional jump or move depends on uninitialised value(s) ==2350== at 0x400AF0F: (within /lib/ld-2.11.1.so)... (0 Replies)
Discussion started by: niranjanvg
0 Replies

6. Ubuntu

valgrind

Hello, I want to install and run a tool called Daikon on my Ubuntu(latest version) While compiling I got this error--------> checking the GLIBC_VERSION version... unsupported version configure: error: Valgrind requires glibc version 2.2 - 2.11 make: *** Error 1 make: Leaving directory... (3 Replies)
Discussion started by: paramad
3 Replies

7. UNIX for Dummies Questions & Answers

Using Valgrind with already running process

I have a process(c program) which runs as daemon and is causing memory leak. Is there any way to detect memory leak in this already running process? Just like we attach gdb to a live process to debug it, can I use valgrind to detect memory leak in such live process? When I tried using valgrind... (3 Replies)
Discussion started by: rupeshkp728
3 Replies
Test::Valgrind::Action::Captor(3pm)			User Contributed Perl Documentation		       Test::Valgrind::Action::Captor(3pm)

NAME
Test::Valgrind::Action::Captor - Mock Test::Valgrind::Action for capturing output. VERSION
Version 1.13 DESCRIPTION
This class provides helpers for saving, redirecting and restoring filehandles. It's not meant to be used directly as an action. METHODS
"new" Just a croaking stub to remind you not to use this class as a real action. "save_fh $from, $mode [, $to ]" Save the original filehandle $from opened with mode $mode, and redirect it to $to if it's defined or to /dev/null otherwise. "restore_all_fh" Restore all the filehandles that were saved with "save_fh" to their original state. The redirections aren't closed. SEE ALSO
Test::Valgrind, Test::Valgrind::Action. Capture::Tiny. AUTHOR
Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>. You can contact me by mail or on "irc.perl.org" (vincent). BUGS
Please report any bugs or feature requests to "bug-test-valgrind at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Valgrind <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Valgrind>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT
You can find documentation for this module with the perldoc command. perldoc Test::Valgrind::Action::Captor COPYRIGHT &; LICENSE Copyright 2009,2010,2011 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-08-25 Test::Valgrind::Action::Captor(3pm)
All times are GMT -4. The time now is 09:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy