Skip to content

Commit

Permalink
memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
rockowitz committed Oct 25, 2024
1 parent 09c3770 commit cb2ae02
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
17 changes: 13 additions & 4 deletions src/base/i2c_bus_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void i2c_reset_bus_info(I2C_Bus_Info * businfo) {
bool debug = false;
assert(businfo);
DBGTRC_STARTING(debug, TRACE_GROUP, "businfo=%p, busno = %d, flags=%s",
businfo, businfo->busno, i2c_interpret_bus_flags(businfo->flags));
businfo, businfo->busno, i2c_interpret_bus_flags_t(businfo->flags));
if (i2c_device_exists(businfo->busno))
businfo->flags &= ~(I2C_BUS_ACCESSIBLE | I2C_BUS_ADDR_X30 | I2C_BUS_ADDR_X37 |
I2C_BUS_SYSFS_EDID | I2C_BUS_X50_EDID );
Expand Down Expand Up @@ -699,6 +699,10 @@ Error_Info * i2c_check_device_access(char * dev_name) {
}


//
// x37 detection table - Records x37 responsiveness to avoid recheck
//

const char * x37_detection_state_name(X37_Detection_State state) {
char * s = NULL;
switch(state) {
Expand Down Expand Up @@ -726,7 +730,7 @@ void i2c_record_x37_detected(int busno, Byte * edidbytes, X37_Detection_State d
x37_detection_state_name(detected), busno, hexstring_t(edidbytes+120, 8));

if (!x37_detection_table)
x37_detection_table = g_hash_table_new(g_str_hash, g_str_equal);
x37_detection_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
assert(detected != X37_Not_Recorded);
char * key = x37_detection_table_key(busno, edidbytes);
g_hash_table_replace(x37_detection_table, key, GINT_TO_POINTER(detected));
Expand Down Expand Up @@ -775,10 +779,15 @@ void init_i2c_bus_base() {
}

void terminate_i2c_bus_base() {
DBGMSG("Executing. x37_detection_table = %p", x37_detection_table);
// DBGMSG("Executing. x37_detection_table = %p", x37_detection_table);
if (x37_detection_table) {
g_hash_table_destroy(x37_detection_table);
}
}

if (all_i2c_buses) {
// i2c_free_bus_info() already set as free function
g_ptr_array_free(all_i2c_buses, true);
free (all_i2c_buses);
}
}

4 changes: 2 additions & 2 deletions src/ddc/ddc_common_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ drm_enabled = false;
// get_sys_drm_connectors(false); // initializes global sys_drm_connectors
if (use_drm_connector_states)
redetect_drm_connector_states();
DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "use_drm_connector_states=%s, drm_enabled = %s, sys_drm_connectors = %p",
sbool(use_drm_connector_states), sbool(drm_enabled), sys_drm_connectors);
DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "use_drm_connector_states=%s, drm_enabled = %s",
sbool(use_drm_connector_states), sbool(drm_enabled));

#ifdef NOT_HERE
// adding or removing MST device can change whether all drm connectors have connector_id
Expand Down
1 change: 1 addition & 0 deletions src/i2c/i2c_bus_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,7 @@ i2c_non_async_scan(GPtrArray * i2c_buses) {
"Calling i2c_check_bus() synchronously for bus %d", businfo->busno);
i2c_check_bus2(businfo);
}

DBGTRC_DONE(debug, TRACE_GROUP, "");
}

Expand Down

0 comments on commit cb2ae02

Please sign in to comment.