<commit_before>// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/cros/cros_library.h"

#include "chrome/browser/chromeos/cros/cros_library_loader.h"
#include "chrome/browser/chromeos/cros/cryptohome_library.h"
#include "chrome/browser/chromeos/cros/keyboard_library.h"
#include "chrome/browser/chromeos/cros/language_library.h"
#include "chrome/browser/chromeos/cros/login_library.h"
#include "chrome/browser/chromeos/cros/mount_library.h"
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/cros/power_library.h"
#include "chrome/browser/chromeos/cros/screen_lock_library.h"
#include "chrome/browser/chromeos/cros/speech_synthesis_library.h"
#include "chrome/browser/chromeos/cros/synaptics_library.h"
#include "chrome/browser/chromeos/cros/syslogs_library.h"

namespace chromeos {

CrosLibrary::CrosLibrary() : library_loader_(NULL),
                             crypto_lib_(NULL),
                             keyboard_lib_(NULL),
                             language_lib_(NULL),
                             login_lib_(NULL),
                             mount_lib_(NULL),
                             network_lib_(NULL),
                             power_lib_(NULL),
                             screen_lock_lib_(NULL),
                             speech_synthesis_lib_(NULL),
                             synaptics_lib_(NULL),
                             syslogs_lib_(NULL),
                             own_library_loader_(true),
                             own_cryptohome_lib_(true),
                             own_language_lib_(true),
                             own_login_lib_(true),
                             own_mount_lib_(true),
                             own_network_lib_(true),
                             own_power_lib_(true),
                             own_screen_lock_lib_(true),
                             own_speech_synthesis_lib_(true),
                             own_synaptics_lib_(true),
                             own_syslogs_lib_(true),
                             loaded_(false),
                             load_error_(false),
                             test_api_(NULL) {

}

CrosLibrary::~CrosLibrary() {
  if (own_library_loader_)<commit_msg>Initialize |own_keyboard_lib_| correctly in the constructor to fix memory leak  (and the valgrind errors below.)<commit_after>// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/cros/cros_library.h"

#include "chrome/browser/chromeos/cros/cros_library_loader.h"
#include "chrome/browser/chromeos/cros/cryptohome_library.h"
#include "chrome/browser/chromeos/cros/keyboard_library.h"
#include "chrome/browser/chromeos/cros/language_library.h"
#include "chrome/browser/chromeos/cros/login_library.h"
#include "chrome/browser/chromeos/cros/mount_library.h"
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/cros/power_library.h"
#include "chrome/browser/chromeos/cros/screen_lock_library.h"
#include "chrome/browser/chromeos/cros/speech_synthesis_library.h"
#include "chrome/browser/chromeos/cros/synaptics_library.h"
#include "chrome/browser/chromeos/cros/syslogs_library.h"

namespace chromeos {

CrosLibrary::CrosLibrary() : library_loader_(NULL),
                             crypto_lib_(NULL),
                             keyboard_lib_(NULL),
                             language_lib_(NULL),
                             login_lib_(NULL),
                             mount_lib_(NULL),
                             network_lib_(NULL),
                             power_lib_(NULL),
                             screen_lock_lib_(NULL),
                             speech_synthesis_lib_(NULL),
                             synaptics_lib_(NULL),
                             syslogs_lib_(NULL),
                             own_library_loader_(true),
                             own_cryptohome_lib_(true),
                             own_keyboard_lib_(true),
                             own_language_lib_(true),
                             own_login_lib_(true),
                             own_mount_lib_(true),
                             own_network_lib_(true),
                             own_power_lib_(true),
                             own_screen_lock_lib_(true),
                             own_speech_synthesis_lib_(true),
                             own_synaptics_lib_(true),
                             own_syslogs_lib_(true),
                             loaded_(false),
                             load_error_(false),
                             test_api_(NULL) {

}

CrosLibrary::~CrosLibrary() {
  if (own_library_loader_)
{'fraction_non_alphanumeric': 0.08753799392097264, 'fraction_numerical': 0.0016210739614994933, 'mean_word_length': 1.6695511087074093, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7140259', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1318, 'n_words': 188}