<commit_before>#include <config.h>

#include "internal.h"
#include "testutils.h"
#include "datatypes.h"
#include "storage/storage_util.h"
#include "testutilsqemu.h"
#include "virstring.h"

#define VIR_FROM_THIS VIR_FROM_NONE

#ifndef MOUNT
# define MOUNT "/usr/bin/mount"
#endif

#ifndef VGCHANGE
# define VGCHANGE "/usr/sbin/vgchange"
#endif

static int
testCompareXMLToArgvFiles(bool shouldFail,
                          const char *poolxml,
                          const char *cmdline)
{
    int ret = -1;
    virStoragePoolDefPtr def = NULL;
    virStoragePoolObjPtr pool = NULL;
    const char *defTypeStr;
    VIR_AUTOFREE(char *) actualCmdline = NULL;
    VIR_AUTOFREE(char *) src = NULL;
    VIR_AUTOPTR(virCommand) cmd = NULL;

    if (!(def = virStoragePoolDefParseFile(poolxml)))
        goto cleanup;
    defTypeStr = virStoragePoolTypeToString(def->type);

    switch ((virStoragePoolType)def->type) {
    case VIR_STORAGE_POOL_FS:
    case VIR_STORAGE_POOL_NETFS:
        if (!(pool = virStoragePoolObjNew())) {
            VIR_TEST_DEBUG("pool type '%s' alloc pool obj fails\n", defTypeStr);
            virStoragePoolDefFree(def);
            goto cleanup;
        }
        virStoragePoolObjSetDef(pool, def);

        if (!(src = virStorageBackendFileSystemGetPoolSource(pool))) {
            VIR_TEST_DEBUG("pool type '%s' has no pool source\n", defTypeStr);
            def = NULL;
            goto cleanup;<commit_msg>storagepoolxml2argvtest: Avoid double free<commit_after>#include <config.h>

#include "internal.h"
#include "testutils.h"
#include "datatypes.h"
#include "storage/storage_util.h"
#include "testutilsqemu.h"
#include "virstring.h"

#define VIR_FROM_THIS VIR_FROM_NONE

#ifndef MOUNT
# define MOUNT "/usr/bin/mount"
#endif

#ifndef VGCHANGE
# define VGCHANGE "/usr/sbin/vgchange"
#endif

static int
testCompareXMLToArgvFiles(bool shouldFail,
                          const char *poolxml,
                          const char *cmdline)
{
    int ret = -1;
    virStoragePoolDefPtr def = NULL;
    virStoragePoolObjPtr pool = NULL;
    const char *defTypeStr;
    VIR_AUTOFREE(char *) actualCmdline = NULL;
    VIR_AUTOFREE(char *) src = NULL;
    VIR_AUTOPTR(virCommand) cmd = NULL;

    if (!(def = virStoragePoolDefParseFile(poolxml)))
        goto cleanup;
    defTypeStr = virStoragePoolTypeToString(def->type);

    switch ((virStoragePoolType)def->type) {
    case VIR_STORAGE_POOL_FS:
    case VIR_STORAGE_POOL_NETFS:
        if (!(pool = virStoragePoolObjNew())) {
            VIR_TEST_DEBUG("pool type '%s' alloc pool obj fails\n", defTypeStr);
            goto cleanup;
        }
        virStoragePoolObjSetDef(pool, def);

        if (!(src = virStorageBackendFileSystemGetPoolSource(pool))) {
            VIR_TEST_DEBUG("pool type '%s' has no pool source\n", defTypeStr);
            def = NULL;
            goto cleanup;
{'fraction_non_alphanumeric': 0.10581273929690219, 'fraction_numerical': 0.0010442046641141664, 'mean_word_length': 3.0195804195804197, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '645565', 'n_tokens_mistral': 944, 'n_tokens_neox': 940, 'n_words': 209}