<commit_before>#include "custom_check.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "logger.h"

extern custom_check_t custom_check_create(char *query, char *operator,
					  char *expected_result)
{
    custom_check_t check = malloc(sizeof(custom_check_t));


    if (check) {
	CUSTOM_CHECK_QUERY(check) = malloc(strlen(query)+1);
	CUSTOM_CHECK_RESULT(check) = malloc(strlen(expected_result)+1);
	CUSTOM_CHECK_OPERATOR(check) = malloc(strlen(operator)+1);
	if (CUSTOM_CHECK_QUERY(check) &&
	    CUSTOM_CHECK_RESULT(check) &&
	    CUSTOM_CHECK_OPERATOR(check)) {
	    strcpy(CUSTOM_CHECK_QUERY(check), query);
	    strcpy(CUSTOM_CHECK_RESULT(check), expected_result);
	    strcpy(CUSTOM_CHECK_OPERATOR(check), operator);
	}
    }
    else
	logger_write(LOG_CRIT, "%m");<commit_msg>Fix memory allocation on custom checks<commit_after>#include "custom_check.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "logger.h"

extern custom_check_t custom_check_create(char *query, char *operator,
					  char *expected_result)
{
    custom_check_t check = malloc(sizeof(struct custom_check));


    if (check) {
	CUSTOM_CHECK_QUERY(check) = malloc(strlen(query)+1);
	CUSTOM_CHECK_RESULT(check) = malloc(strlen(expected_result)+1);
	CUSTOM_CHECK_OPERATOR(check) = malloc(strlen(operator)+1);
	if (CUSTOM_CHECK_QUERY(check) &&
	    CUSTOM_CHECK_RESULT(check) &&
	    CUSTOM_CHECK_OPERATOR(check)) {
	    strcpy(CUSTOM_CHECK_QUERY(check), query);
	    strcpy(CUSTOM_CHECK_RESULT(check), expected_result);
	    strcpy(CUSTOM_CHECK_OPERATOR(check), operator);
	}
    }
    else
	logger_write(LOG_CRIT, "%m");
{'fraction_non_alphanumeric': 0.13048780487804879, 'fraction_numerical': 0.003658536585365854, 'mean_word_length': 5.982978723404256, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2703550', 'n_tokens_mistral': 633, 'n_tokens_neox': 600, 'n_words': 89}