ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

JuSU's profile - activity

2016-10-18 08:34:52 -0500 received badge  Popular Question (source)
2016-10-18 08:34:52 -0500 received badge  Notable Question (source)
2016-10-18 08:34:52 -0500 received badge  Famous Question (source)
2016-10-18 08:34:49 -0500 received badge  Student (source)
2016-05-18 12:52:20 -0500 asked a question crashing node: free() invalid pointer error caused by imageTransport

I'm trying to run the subscriber node example from this tutorial http://wiki.ros.org/image_transport/T... , about writing an image subscriber node using the image_transport package. It compiles, but when I try to run it I get an error saying free() invalid pointer. I'm using ros Indigo on Ubuntu 14.04 x86.

This is the code from the tutorial:

#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <opencv2/highgui/highgui.hpp>
#include <cv_bridge/cv_bridge.h>
//
void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
try
{
cv::imshow("view", cv_bridge::toCvShare(msg, "bgr8")->image);
cv::waitKey(30);
}
catch (cv_bridge::Exception& e)
{
ROS_ERROR("Could not convert from '%s' to 'bgr8'.", msg->encoding.c_str());
}
}

int main(int argc, char **argv)
{
ros::init(argc, argv, "image_listener");
ros::NodeHandle nh;
cv::namedWindow("view");
cv::startWindowThread();
image_transport::ImageTransport it(nh);
image_transport::Subscriber sub = it.subscribe("softkinetic_bringup_node/rgb/image_color", 1, imageCallback);
ros::spin();
cv::destroyWindow("view");
}

Compiling returns no errors. The error after trying to run the node with rosrun:

*** Error in `/home/*/ros/devel/lib/controllers/experiment5': free(): invalid pointer: 0x000000000061e678 ***
Aborted (core dumped)

gdb run:

(gdb) r
Starting program: /home/*/ros/devel/lib/controllers/experiment5 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffde7ca700 (LWP 27899)]
[New Thread 0x7fffdd6da700 (LWP 27901)]
[New Thread 0x7fffdced9700 (LWP 27902)]
[New Thread 0x7fffd7fff700 (LWP 27903)]
[New Thread 0x7fffd77fe700 (LWP 27908)]
[New Thread 0x7fffd5f7d700 (LWP 27909)]
[New Thread 0x7fffd577c700 (LWP 27910)]
[New Thread 0x7fffd4f7b700 (LWP 27911)]
*** Error in `/home/*/ros/devel/lib/controllers/experiment5': free(): invalid pointer: 0x000000000061e678 ***

Program received signal SIGABRT, Aborted.
0x00007ffff6495cc9 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.

gdb where:

(gdb) where
#0  0x00007ffff6495cc9 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff64990d8 in __GI_abort () at abort.c:89
#2  0x00007ffff64d2394 in __libc_message (do_abort=do_abort@entry=1, 
    fmt=fmt@entry=0x7ffff65e0b28 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007ffff64de66e in malloc_printerr (ptr=<optimized out>, 
    str=0x7ffff65dcc19 "free(): invalid pointer", action=1) at malloc.c:4996
#4  _int_free (av=<optimized out>, p=<optimized out>, have_lock=0)
    at malloc.c:3840
#5  0x00007fffeee34243 in rospack::Stackage::~Stackage() ()
   from /opt/ros/indigo/lib/librospack.so
#6  0x00007fffeee2ac2f in rospack::Rosstackage::addStackage(std::string const&)
    () from /opt/ros/indigo/lib/librospack.so
#7  0x00007fffeee2ed0d in rospack::Rosstackage::crawlDetail(std::string const&, bool, int, bool, std::vector<rospack::DirectoryCrawlRecord*, std::allocator<rospack::DirectoryCrawlRecord*> >&, boost::unordered::unordered_set<std::string, boost::hash<std::string>, std::equal_to<std::string>, std::allocator<std::string> >&) () from /opt/ros/indigo/lib/librospack.so
#8  0x00007fffeee2ec53 in rospack::Rosstackage::crawlDetail(std::string const&, bool, int, bool, std::vector<rospack::DirectoryCrawlRecord*, std::allocator<rospack::DirectoryCrawlRecord*> >&, boost::unordered::unordered_set<std::string, boost::hash<std::string>, std::equal_to<std::string>, std::allocator<std::string> >---Type <return> to continue, or q <return> to quit---
&) () from /opt/ros/indigo ...
(more)