Просмотр исходного кода

Allow totemsrp to remove the reference information for a token callback.

(Logical change 1.148)


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@523 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 21 лет назад
Родитель
Сommit
3e6bf37300
2 измененных файлов с 10 добавлено и 6 удалено
  1. 9 5
      exec/totemsrp.c
  2. 1 1
      exec/totemsrp.h

+ 9 - 5
exec/totemsrp.c

@@ -2494,12 +2494,16 @@ int totemsrp_callback_token_create (void **handle_out,
 	return (0);
 	return (0);
 }
 }
 
 
-void totemsrp_callback_token_destroy (void *handle)
+void totemsrp_callback_token_destroy (void **handle_out)
 {
 {
-	struct token_callback_instance *h = (struct token_callback_instance *)handle;
-	
-	list_del (&h->list);
-	free (h);
+	struct token_callback_instance *h;
+
+	if (*handle_out) {
+ 		h = (struct token_callback_instance *)*handle_out;
+		list_del (&h->list);
+		free (h);
+		*handle_out = 0;
+	}
 }
 }
 
 
 void totemsrp_callback_token_type (void *handle)
 void totemsrp_callback_token_type (void *handle)

+ 1 - 1
exec/totemsrp.h

@@ -128,6 +128,6 @@ int totemsrp_callback_token_create (
 	void *data);
 	void *data);
 
 
 void totemsrp_callback_token_destroy (
 void totemsrp_callback_token_destroy (
-	void *handle);
+	void **handle_out);
 
 
 #endif /* TOTEMSRP_H_DEFINED */
 #endif /* TOTEMSRP_H_DEFINED */