소스 검색

Fix coverity bug ID 5

In poll_timer_add() if you pass in a NULL for the callback function
the pointer will be dereferenced.

I have moved the check for the NULL up.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1714 fd59a12c-fef9-0310-b244-a6a79926bd2f
Angus Salkeld 17 년 전
부모
커밋
2998d698ad
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 5
      exec/coropoll.c

+ 5 - 5
exec/coropoll.c

@@ -291,18 +291,18 @@ int poll_timer_add (
 	struct poll_instance *poll_instance;
 	int res = 0;
 
+	if (timer_handle_out == NULL) {
+		res -ENOENT;
+		goto error_exit;
+	}
+
 	res = hdb_handle_get (&poll_instance_database, handle,
 		(void *)&poll_instance);
 	if (res != 0) {
 		res = -ENOENT;
-		
 		goto error_exit;
 	}
 
-	if (timer_handle_out == 0) {
-		res = -ENOENT;
-	}
-
 	timerlist_add_duration (&poll_instance->timerlist,
 		timer_fn, data, ((unsigned long long)msec_duration) * 1000000ULL, timer_handle_out);