<commit_before>#include <containers.h>

#include "sp_struct.h"
#include "spi_util.h"
#include "debug.h"


struct sp_struct_t {
    const char* name;
    Vector* fields;
};

struct sp_struct_t* sp_struct_init(const char* name) {
    int rc = E_OK;
    struct sp_struct_t* s = NULL;
    _Ag(name != NULL, E_ARGUMENT);
    s = _CALLOC(struct sp_struct_t, 1);
    s->fields = iVector.Create(sizeof(struct sp_field_t), 5);
    s->name = strdup(name);

onError:
    if (rc != 0) {
        sp_struct_free(s);
        s = NULL;
    }
    return s;
}

int sp_struct_free(struct sp_struct_t *s) {
    if (s != NULL) {
        iVector.Finalize(s->fields);
        free(s);
    }
    return E_OK;
}<commit_msg>Mem leak :(<commit_after>#include <containers.h>

#include "sp_struct.h"
#include "spi_util.h"
#include "debug.h"


struct sp_struct_t {
    char* name;
    Vector* fields;
};

struct sp_struct_t* sp_struct_init(const char* name) {
    int rc = E_OK;
    struct sp_struct_t* s = NULL;
    _Ag(name != NULL, E_ARGUMENT);
    s = _CALLOC(struct sp_struct_t, 1);
    s->fields = iVector.Create(sizeof(struct sp_field_t), 5);
    s->name = strdup(name);

onError:
    if (rc != 0) {
        sp_struct_free(s);
        s = NULL;
    }
    return s;
}

int sp_struct_free(struct sp_struct_t *s) {
    if (s != NULL) {
        iVector.Finalize(s->fields);
        free(s->name);
        free(s);
    }
    return E_OK;
}
{'fraction_non_alphanumeric': 0.14386959603118354, 'fraction_numerical': 0.004252303330970942, 'mean_word_length': 2.7754010695187166, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2590231', 'n_tokens_mistral': 567, 'n_tokens_neox': 556, 'n_words': 122}