<commit_before>/*
 * Simple C test program for libpopcnt.h.
 * Generates an array with random data and computes the bit population
 * count using 2 different algorithms and checks that the
 * results match.
 *
 * Usage: ./test2
 *
 * Copyright (C) 2017 <NAME>, <<EMAIL>>
 *
 * This file is distributed under the BSD License. See the LICENSE
 * file in the top level directory.
 */

#include <libpopcnt.h>

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <stdint.h>

int main()
{
  int i, j;
  int size = 50000;

  uint64_t bits;
  uint64_t bits_verify;
  uint8_t* data = (uint8_t*) malloc(size);

  srand((unsigned) time(0));

  for (i = 0; i < size; i++)
    data[i] = (uint8_t) rand();

  for (i = 0; i < size; i++)
  {
    bits = popcnt(&data[i], size - i);
    bits_verify = 0;

    for (j = i; j < size; j++)
      bits_verify += popcount64(data[j]);

    if (bits != bits_verify)
    {
      printf("\nlibpopcnt test failed!\n");
      return 1;
    }
  }

  free(data);

  printf("\rStatus: 100%%\n");
  printf("libpopcnt tested successfully!\n");

  return 0;
}
<commit_msg>Fix memory leak<commit_after>/*
 * Simple C test program for libpopcnt.h.
 * Generates an array with random data and computes the bit population
 * count using 2 different algorithms and checks that the
 * results match.
 *
 * Usage: ./test2
 *
 * Copyright (C) 2017 <NAME>, <<EMAIL>>
 *
 * This file is distributed under the BSD License. See the LICENSE
 * file in the top level directory.
 */

#include <libpopcnt.h>

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <stdint.h>

int main()
{
  int i, j;
  int size = 50000;

  uint64_t bits;
  uint64_t bits_verify;
  uint8_t* data = (uint8_t*) malloc(size);

  srand((unsigned) time(0));

  for (i = 0; i < size; i++)
    data[i] = (uint8_t) rand();

  for (i = 0; i < size; i++)
  {
    bits = popcnt(&data[i], size - i);
    bits_verify = 0;

    for (j = i; j < size; j++)
      bits_verify += popcount64(data[j]);

    if (bits != bits_verify)
    {
      printf("\nlibpopcnt test failed!\n");
      free(data);
      return 1;
    }
  }

  free(data);

  printf("\rStatus: 100%%\n");
  printf("libpopcnt tested successfully!\n");

  return 0;
}

{'fraction_non_alphanumeric': 0.1527027027027027, 'fraction_numerical': 0.026126126126126126, 'mean_word_length': 2.9519572953736657, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 19, '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': '4686750', 'n_tokens_mistral': 859, 'n_tokens_neox': 790, 'n_words': 255}