Skip to content

Memory bug: Double free or corruption #6

@rs22

Description

@rs22

Running the scils_example_local multiple times in succession yields a double free or corruption (out) crash on the client side.

Script to reproduce (assuming code is compiled using CMake in build):

#! /bin/bash -e

cd build/bin/exe/examples

function run_scils() {
    MODE=$1

    # Set up fifo to be able to pass in commands
    rm -f /tmp/$MODE-input
    mkfifo /tmp/$MODE-input
    # Keep the fifo open
    cat > /tmp/$MODE-input &

    tail -f /tmp/$MODE-input | ./scils_example_local $MODE &
}

run_scils s
SERVER=$!

# Listen
echo "" > /tmp/s-input
sleep 1

while ps -p $SERVER > /dev/null; do
    echo "Connecting to server..."

    run_scils c
    CLIENT=$!

    # Connect
    echo "" > /tmp/c-input
    sleep 1

    # Disconnect
    echo "" > /tmp/c-input
    wait $CLIENT || break
    sleep 1
done

kill $SERVER

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions