#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

# include "psvideophot.h"

void psvideophotCleanup (pmConfig *config, psvideophotOptions *options)
{
    if (psErrorCodeLast() != PS_ERR_NONE) {
        pmFPAfileFreeSetStrict(false);
    }

    // Free memory used by psvideophot
    psFree(options);
    psFree(config);

    // Free memory used by psModules
    pmSourceFitSetDone ();
    pmConceptsDone();
    pmConfigDone();
    pmModelClassCleanup();
    pmVisualCleanup ();

    // Free memory used by psLib
    psLibFinalize();

    // psMemBlock **memblocks;
    // int Nleaks = psMemCheckLeaks (0, &memblocks, stderr, false);
    // fprintf (stderr, "Found %d leaks at %s\n", Nleaks, "psvideophot");

    // fprintf(stderr, "Found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "psvideophot");
    psLogMsg("psvideophot", PS_LOG_INFO, "Memory leaks: %d\n", psMemCheckLeaks(0, NULL, stdout, false));

    return;
}
