~ubuntu-branches/ubuntu/utopic/thermald/utopic-proposed

« back to all changes in this revision

Viewing changes to src/thd_engine_default.cpp

  • Committer: Package Import Robot
  • Author(s): Colin King, Colin Ian King, Srinivas Pandruvada
  • Date: 2014-03-12 10:03:33 UTC
  • Revision ID: package-import@ubuntu.com-20140312100333-3s2g2c6tvl2r550x
Tags: 1.1~rc2-10
[Colin Ian King]
* coverity scan: fix memory leak on trip_ptr
* coverity scan: fix leaking dir on error exit path
[Srinivas Pandruvada]
* coverity scan: fix Unrecoverable parse warning
* coverity scan: Untrusted loop bound
* coverity scan: Uninitialized scalar field errors

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
// Default CPU cooling devices, which are not part of thermal sysfs
39
39
// Since non trivial initialization is not supported, we init all fields even if they are not needed
40
 
static cooling_dev_t cpu_def_cooling_devices[] = {
41
 
        {       .status = true,
42
 
                .mask = CDEV_DEF_BIT_UNIT_VAL | CDEV_DEF_BIT_READ_BACK | CDEV_DEF_BIT_MIN_STATE | CDEV_DEF_BIT_STEP,
43
 
                .index = 0, .unit_val = ABSOULUTE_VALUE, .min_state = 0, .max_state = 0, .inc_dec_step = 5,
44
 
                .read_back = false, .auto_down_control = false,
45
 
                .type_string = "intel_powerclamp", .path_str = "",
46
 
                .debounce_interval = 4, .pid_enable = false,
47
 
                .pid = {0.0, 0.0, 0.0}},
48
 
};
 
40
/* Some security scan handler can't parse, the following block and generate unnecessary errors.
 
41
 * hiding good ones. So init in old style compatible to C++
 
42
 
 
43
 static cooling_dev_t cpu_def_cooling_devices[] = {
 
44
 {      .status = true,
 
45
 .mask = CDEV_DEF_BIT_UNIT_VAL | CDEV_DEF_BIT_READ_BACK | CDEV_DEF_BIT_MIN_STATE | CDEV_DEF_BIT_STEP,
 
46
 .index = 0, .unit_val = ABSOULUTE_VALUE, .min_state = 0, .max_state = 0, .inc_dec_step = 5,
 
47
 .read_back = false, .auto_down_control = false,
 
48
 .type_string = "intel_powerclamp", .path_str = "",
 
49
 .debounce_interval = 4, .pid_enable = false,
 
50
 .pid = {0.0, 0.0, 0.0}},
 
51
 };
 
52
 */
 
53
static cooling_dev_t cpu_def_cooling_devices[] = { { true, CDEV_DEF_BIT_UNIT_VAL
 
54
                | CDEV_DEF_BIT_READ_BACK | CDEV_DEF_BIT_MIN_STATE | CDEV_DEF_BIT_STEP,
 
55
                0, ABSOULUTE_VALUE, 0, 0, 5, false, false, "intel_powerclamp", "", 4,
 
56
                false, { 0.0, 0.0, 0.0 } } };
49
57
 
50
58
cthd_engine_default::~cthd_engine_default() {
51
59
        if (parser_init_done)
109
117
                                                                        temp_input_str.str(), SENSOR_TYPE_RAW);
110
118
                                                        if (sensor->sensor_update() != THD_SUCCESS) {
111
119
                                                                delete sensor;
 
120
                                                                closedir(dir);
112
121
                                                                return THD_ERROR;
113
122
                                                        }
114
123
                                                        sensors.push_back(sensor);