<commit_before>#include "buzzset.h"
#include <stdlib.h>
#include <string.h>

/****************************************/
/****************************************/

struct buzzset_tree_s {
   void* data;
   struct buzzset_tree_s* left;
   struct buzzset_tree_s* right;
};
typedef struct buzzset_tree_s* buzzset_tree_t;

/****************************************/
/****************************************/

/* Creates a new tree node */
static buzzset_tree_t buzzset_tree_new(buzzset_t s,
                                       const void* data) {
   buzzset_tree_t x = (buzzset_tree_t)malloc(sizeof(struct buzzset_tree_s));
   x->data = malloc(s->data_size);
   memcpy(x->data, data, s->data_size);
   x->left = NULL;
   x->right = NULL;
   return x;
}

/* Destroys a node and its children */
static void buzzset_tree_destroy(buzzset_t s,
                                 buzzset_tree_t n) {
   if(!n) return;
   if(n->left) buzzset_tree_destroy(s, n->left);
   if(n->right) buzzset_tree_destroy(s, n->right);
   if(s->dstryf) s->dstryf(&n->data, NULL);
   else free(n->data);
   free(n);
}

/* Inserts a new node in the tree */
static buzzset_tree_t buzzset_tree_insert(buzzset_t s,
                                          buzzset_tree_t n,
                                          const void* data,
                                          int* added) {
   /* Insert element here */
   if(!n) {
      *added = 1;
      return buzzset_tree_new(s, data);
   }
   else {<commit_msg>Memory leak fix - take 2.<commit_after>#include "buzzset.h"
#include <stdlib.h>
#include <string.h>

/****************************************/
/****************************************/

struct buzzset_tree_s {
   void* data;
   struct buzzset_tree_s* left;
   struct buzzset_tree_s* right;
};
typedef struct buzzset_tree_s* buzzset_tree_t;

/****************************************/
/****************************************/

/* Creates a new tree node */
static buzzset_tree_t buzzset_tree_new(buzzset_t s,
                                       const void* data) {
   buzzset_tree_t x = (buzzset_tree_t)malloc(sizeof(struct buzzset_tree_s));
   x->data = malloc(s->data_size);
   memcpy(x->data, data, s->data_size);
   x->left = NULL;
   x->right = NULL;
   return x;
}

/* Destroys a node and its children */
static void buzzset_tree_destroy(buzzset_t s,
                                 buzzset_tree_t n) {
   if(!n) return;
   if(n->left) buzzset_tree_destroy(s, n->left);
   if(n->right) buzzset_tree_destroy(s, n->right);
   if(s->dstryf) s->dstryf(n->data, NULL);
   free(n->data);
   free(n);
}

/* Inserts a new node in the tree */
static buzzset_tree_t buzzset_tree_insert(buzzset_t s,
                                          buzzset_tree_t n,
                                          const void* data,
                                          int* added) {
   /* Insert element here */
   if(!n) {
      *added = 1;
      return buzzset_tree_new(s, data);
   }
   else {
{'fraction_non_alphanumeric': 0.21606182795698925, 'fraction_numerical': 0.0010080645161290322, 'mean_word_length': 2.4100801832760594, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '722680', 'n_tokens_mistral': 956, 'n_tokens_neox': 938, 'n_words': 205}