Opened 6 years ago

#12188 new Bugs

Valgrind reports invalid delete after using boost::asio::ip::tcp::resolver.resolve

Reported by: Mateusz Wójcik <mateusz.wojcik@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.60.0 Severity: Problem
Keywords: asio valgrind resolver Cc:

Description

OS:

Debian 3.16.7-ckt20-1+deb8u4 (2016-02-29) x86_64 GNU/Linux

COMPILER:

gcc version 4.9.2 (Debian 4.9.2-10)

SOURCE:

#include <boost/asio.hpp>
int main()
{
    boost::asio::io_service queue;
    boost::asio::ip::tcp::resolver resolver( queue );
    boost::asio::ip::tcp::resolver::query query( "google.com", "" );
    resolver.resolve( query );
    queue.run();
}

COMMAND:

gcc main.cpp -lstdc++ -pthread -lboost_system
valgrind ./a.out

OUTPUT:

==20844== Memcheck, a memory error detector
==20844== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==20844== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==20844== Command: ./a.out
==20844== 
==20844== Invalid free() / delete / delete[] / realloc()
==20844==    at 0x4C29E90: free (vg_replace_malloc.c:473)
==20844==    by 0x58C249B: __libc_freeres (in /lib/x86_64-linux-gnu/libc-2.19.so)
==20844==    by 0x4A236CC: _vgnU_freeres (vg_preloaded.c:63)
==20844==    by 0x57ADAEA: __run_exit_handlers (exit.c:97)
==20844==    by 0x57ADB74: exit (exit.c:104)
==20844==    by 0x5797B4B: (below main) (libc-start.c:321)
==20844==  Address 0x5b1b2d0 is 0 bytes inside data symbol "noai6ai_cached"
==20844== 
==20844== 
==20844== HEAP SUMMARY:
==20844==     in use at exit: 0 bytes in 0 blocks
==20844==   total heap usage: 79 allocs, 80 frees, 11,451 bytes allocated
==20844== 
==20844== All heap blocks were freed -- no leaks are possible
==20844== 
==20844== For counts of detected and suppressed errors, rerun with: -v
==20844== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Change History (0)

Note: See TracTickets for help on using tickets.