Don't check return status of notification_create
notification_create is guaranteed to return a pointer to a notification, if the memory allocation fails it throws an error and exits the program.
This commit is contained in:
		
							parent
							
								
									0a0c02021d
								
							
						
					
					
						commit
						0cb1524cc6
					
				| @ -296,9 +296,6 @@ static void on_notify(GDBusConnection * connection, | ||||
|         } | ||||
| 
 | ||||
|         notification *n = notification_create(); | ||||
|         if(n == NULL) { | ||||
|                 die("Unable to allocate memory", EXIT_FAILURE); | ||||
|         } | ||||
|         n->appname = appname; | ||||
|         n->summary = summary; | ||||
|         n->body = body; | ||||
|  | ||||
| @ -344,9 +344,6 @@ int dunst_main(int argc, char *argv[]) | ||||
| 
 | ||||
|         if (settings.startup_notification) { | ||||
|                 notification *n = notification_create(); | ||||
|                 if(n == NULL) { | ||||
|                         die("Unable to allocate memory", EXIT_FAILURE); | ||||
|                 } | ||||
|                 n->appname = strdup("dunst"); | ||||
|                 n->summary = strdup("startup"); | ||||
|                 n->body = strdup("dunst is up and running"); | ||||
|  | ||||
| @ -321,6 +321,7 @@ char *notification_extract_markup_urls(char **str_ptr) { | ||||
| notification *notification_create(void) | ||||
| { | ||||
|         notification *n = malloc(sizeof(notification)); | ||||
|         if(n == NULL) die("Unable to allocate memory", EXIT_FAILURE); | ||||
|         memset(n, 0, sizeof(notification)); | ||||
|         return n; | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Nikos Tsipinakis
						Nikos Tsipinakis