Browse Source

starputop_message_queue_new() : make sure we avoid dereferencing a null pointer.

[scan-build] Dereference of null pointer
Cyril Roelandt 13 years ago
parent
commit
60f3f89b75
2 changed files with 2 additions and 0 deletions
  1. 1 0
      src/top/starpu_top.c
  2. 1 0
      src/top/starputop_message_queue.c

+ 1 - 0
src/top/starpu_top.c

@@ -135,6 +135,7 @@ void starputop_init_and_wait(const char* server_name){
 
 	//init locked queue before adding the first message
 	starputop_mt = starputop_message_queue_new();
+	STARPU_ASSERT(starputop_mt);
 
 	//waiting for UI to connect
 	printf("%s:%d launching network threads\n", __FILE__, __LINE__);

+ 1 - 0
src/top/starputop_message_queue.c

@@ -100,6 +100,7 @@ starputop_message_queue_t* starputop_message_queue_new(void)
 	if( NULL == p )
 	{
 		fprintf(stderr, "LINE: %d, malloc() failed\n", __LINE__);
+		return NULL;
 	}
 
 	p->head = p->tail = NULL;