Skip to content

Commit

Permalink
Free allocated memory in torque driver
Browse files Browse the repository at this point in the history
This is a minor memory leak if the cluster_label struct member is
set in the driver.

Also sort the free statements to match the order in the defining struct.
  • Loading branch information
berland committed Aug 17, 2023
1 parent 61000b5 commit ecf0d77
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/clib/lib/job_queue/torque_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,14 +819,16 @@ void torque_driver_kill_job(void *__driver, void *__job) {
void torque_driver_free(torque_driver_type *driver) {
torque_driver_set_debug_output(driver, NULL);
free(driver->queue_name);
free(driver->qdel_cmd);
free(driver->qsub_cmd);
free(driver->qstat_cmd);
free(driver->qstat_opts);
free(driver->qsub_cmd);
free(driver->qdel_cmd);
free(driver->num_cpus_per_node_char);
free(driver->num_nodes_char);
if (driver->job_prefix)
free(driver->job_prefix);
if (driver->cluster_label)
free(driver->cluster_label)

free(driver);
}
Expand Down

0 comments on commit ecf0d77

Please sign in to comment.