gallium/hud: fix memory leaks
authorEric Engestrom <eric.engestrom@intel.com>
Tue, 19 Mar 2019 14:11:09 +0000 (14:11 +0000)
committerEric Engestrom <eric@engestrom.ch>
Thu, 4 Apr 2019 13:59:24 +0000 (13:59 +0000)
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/hud/hud_cpufreq.c
src/gallium/auxiliary/hud/hud_diskstat.c
src/gallium/auxiliary/hud/hud_nic.c

index d3cf2019c38e632bf2b407eee180c7b37c302ed0..9c7b90f7351accceb2ce70f1ae988f0f902ad442 100644 (file)
@@ -151,6 +151,7 @@ hud_cpufreq_graph_install(struct hud_pane *pane, int cpu_index,
       snprintf(gr->name, sizeof(gr->name), "%s-Max", cfi->name);
       break;
    default:
+      free(gr);
       return;
    }
 
index 7eaaf35a7c7d484e1fa9f7322344066b0df5dfa8..6860567a26ec12b407616389785fb33d25e93db4 100644 (file)
@@ -196,8 +196,10 @@ hud_diskstat_graph_install(struct hud_pane *pane, const char *dev_name,
    else if (dsi->mode == DISKSTAT_WR) {
       snprintf(gr->name, sizeof(gr->name), "%s-Write-MB/s", dsi->name);
    }
-   else
+   else {
+      free(gr);
       return;
+   }
 
    gr->query_data = dsi;
    gr->query_new_value = query_dsi_load;
index b6c0d9edd5521d86e5d523abe3ef38eaa8c741e5..5fab3319db2862a062f0a2e28ec84c8e0edcb5af 100644 (file)
@@ -272,8 +272,10 @@ hud_nic_graph_install(struct hud_pane *pane, const char *nic_name,
    }
    else if (nic->mode == NIC_RSSI_DBM)
       snprintf(gr->name, sizeof(gr->name), "%s-rssi", nic->name);
-   else
+   else {
+      free(gr);
       return;
+   }
 
    gr->query_data = nic;
    gr->query_new_value = query_nic_load;