PDA

View Full Version : glibc - double free or corruption error on system() call in Linux



zlacelle
5th June 2009, 15:39
I've searched through the boards, but have found nothing to help with this problem. I'm writing a program in c++ using Qt in linux, and when a box is checked I want it to run a bash script. I'm using the system("[script]") syntax. Even when I do something as basic as system("echo hello"); the program crashes with "*** glibc detected *** ./[program name] : double free or corruption (fasttop): [mem addr]" followed by a memory dump.

I've tried calling it from my main thread and from my QThread class, and no luck. I've cleaned and recompiled, nothing. Why won't my linux system() call work at all?

Thanks in advance.

Lykurg
5th June 2009, 17:33
Hi, have you seen QProcess for calling other command line executables?

zlacelle
5th June 2009, 19:10
Ah, thank you, no I had not :)

I'll try it and ask if it doesn't work...

Thanks!

zlacelle
5th June 2009, 19:19
Awesome solution, thanks. Works like a charm.