diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-08-24 17:03:29 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-08-24 17:03:31 +0200 |
commit | 29524a65fa8e49aa1a15e691e712466d8c703b61 (patch) | |
tree | f8a8faf369650c7fe2398a139b04a15c8e96c5a1 | |
parent | mds-colour: style + fix buffer overflow + send message id (diff) | |
download | mds-29524a65fa8e49aa1a15e691e712466d8c703b61.tar.gz mds-29524a65fa8e49aa1a15e691e712466d8c703b61.tar.bz2 mds-29524a65fa8e49aa1a15e691e712466d8c703b61.tar.xz |
mds-registry: fix memory free upon error bug
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | src/mds-registry/mds-registry.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mds-registry/mds-registry.c b/src/mds-registry/mds-registry.c index df3db51..f4ed92c 100644 --- a/src/mds-registry/mds-registry.c +++ b/src/mds-registry/mds-registry.c @@ -117,19 +117,17 @@ int initialise_server(void) */ fail_if (full_send(message, strlen(message))); stage++; - fail_if (hash_table_create_tuned(®_table, 32)); stage++; + fail_if (hash_table_create_tuned(®_table, 32)); reg_table.key_comparator = (compare_func*)string_comparator; reg_table.hasher = (hash_func*)string_hash; - fail_if (server_initialised() < 0); + fail_if (server_initialised() < 0); stage++; fail_if (mds_message_initialise(&received)); return 0; fail: xperror(*argv); - if (stage == 1) - hash_table_destroy(®_table, NULL, NULL); - if (stage == 2) - mds_message_destroy(&received); + if (stage >= 1) hash_table_destroy(®_table, NULL, NULL); + if (stage >= 2) mds_message_destroy(&received); return 1; } |