Commit ffb64ca2 authored by Frank Winkler's avatar Frank Winkler
Browse files

Fixed memory leak for user name detection.

parent 2c9a1913
......@@ -125,9 +125,13 @@ extern int prep_p_prolog_slurmctld(job_record_t *job_ptr, bool *async)
int rc = SLURM_SUCCESS;
/* only for testing */
if ( strcmp(uid_to_string_or_null(job_ptr->user_id), "fwinkler") != 0 &&
strcmp(uid_to_string_or_null(job_ptr->user_id), "rotscher") != 0 )
char* user = uid_to_string_or_null(job_ptr->user_id);
if ( strcmp(user, "fwinkler") != 0 &&
strcmp(user, "rotscher") != 0 ) {
xfree(user);
return rc;
}
xfree(user);
slurm_info(PLUGIN_NAME "prep_p_prolog_slurmctld\n");
......@@ -152,10 +156,13 @@ extern int prep_p_epilog_slurmctld(job_record_t *job_ptr, bool *async)
{
int rc = SLURM_SUCCESS;
/* only for testing */
if ( strcmp(uid_to_string_or_null(job_ptr->user_id), "fwinkler") != 0 &&
strcmp(uid_to_string_or_null(job_ptr->user_id), "rotscher") != 0 )
char* user = uid_to_string_or_null(job_ptr->user_id);
if ( strcmp(user, "fwinkler") != 0 &&
strcmp(user, "rotscher") != 0 ) {
xfree(user);
return rc;
}
xfree(user);
slurm_info(PLUGIN_NAME "prep_p_epilog_slurmctld\n");
......@@ -202,7 +209,9 @@ static void job_data_prolog(job_record_t *job_ptr, char **job_data)
snprintf(*job_data, STRING_LEN, "START_TIME = %s\n", time_str);
//user
snprintf(*job_data + strlen(*job_data), STRING_LEN - strlen(*job_data), "USER = %s\n", uid_to_string_or_null(job_ptr->user_id));
char* user = uid_to_string_or_null(job_ptr->user_id);
snprintf(*job_data + strlen(*job_data), STRING_LEN - strlen(*job_data), "USER = %s\n", user);
xfree(user);
// partition
snprintf(*job_data + strlen(*job_data), STRING_LEN - strlen(*job_data), "PARTITION = %s\n", job_ptr->part_ptr->name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment