#!/bin/sh

set -eu

cat <<EOF > test.c
#include <popt.h>

int main(int argc, const char **argv)
{
    int arg;
    poptContext optCon;

    const struct poptOption options[] = {
        POPT_AUTOHELP { NULL, 0, 0, NULL, 0, NULL, NULL }
    };

    optCon = poptGetContext("test", argc, argv, options, 0);

    while ((arg = poptGetNextOpt(optCon)) >= 0) {
    }

    poptFreeContext(optCon);
    return 0;
}
EOF

cc -Wall -Wextra -Werror -O1 -g -fsanitize=address -fno-omit-frame-pointer test.c -lpopt -o test
./test thisleaks17bytes
