Skip to content
Snippets Groups Projects
Commit 828e4d2d authored by Brian Christiansen's avatar Brian Christiansen
Browse files

Ensure that xhash_free sets the hash table pointer to NULL.

parent c77aa354
No related branches found
No related tags found
No related merge requests found
......@@ -184,12 +184,12 @@ void xhash_clear(xhash_t* table)
table->count = 0;
}
void xhash_free(xhash_t* table)
void xhash_free_ptr(xhash_t** table)
{
if (!table)
if (!table || !*table)
return;
xhash_clear(table);
xfree(table);
xhash_clear(*table);
xfree(*table);
}
/* String hash table using the pjw hashing algorithm
......
......@@ -40,6 +40,8 @@
#include <stdint.h>
#include <pthread.h>
#define xhash_free(__p) xhash_free_ptr(&(__p));
/** Opaque definition of the hash table */
typedef struct xhash_st xhash_t;
......@@ -126,7 +128,7 @@ void xhash_clear(xhash_t* table);
* @parameter table is the hash table to free. The table pointer is invalid
* after this call.
*/
void xhash_free(xhash_t* table);
void xhash_free_ptr(xhash_t** table);
/* String hash table using the pjw hashing algorithm
* and chaining conflict resolution.
......
......@@ -901,8 +901,7 @@ int read_slurm_conf(int recover, bool reconfig)
}
node_record_table_ptr = NULL;
node_record_count = 0;
xhash_free (node_hash_table);
node_hash_table = NULL;
xhash_free(node_hash_table);
old_part_list = part_list;
part_list = NULL;
old_def_part_name = default_part_name;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment