(!1959) composite: silence some warnings on possible NULL dereference
Unlikely to practically happen, but still safer to just check for sure.
A simple zero-value test doesn't cost us much (on modern CPUs perhaps
not even a full clock cycle).
| ../composite/compalloc.c: In function ‘compRedirectWindow’:
| ../composite/compalloc.c:167:35: warning: dereference of NULL ‘pClient’ [CWE-476] [-Wanalyzer-null-dereference]
|   167 |     ccw->id = FakeClientID(pClient->index);
|       |                            ~~~~~~~^~~~~~~
| ../composite/compalloc.c: In function ‘compUnredirectWindow’:
| ../composite/compalloc.c:331:75: warning: dereference of NULL ‘pClient’ [CWE-476] [-Wanalyzer-null-dereference]
|   331 |         if (ccw->update == update && dixClientIdForXID(ccw->id) == pClient->index) {
|       |                                                                    ~~~~~~~^~~~~~~
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
			
			
This commit is contained in:
		
							parent
							
								
									6dc4afe936
								
							
						
					
					
						commit
						a25d63e542
					
				|  | @ -43,6 +43,8 @@ | |||
| 
 | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "compint.h" | ||||
| 
 | ||||
| static Bool | ||||
|  | @ -133,6 +135,8 @@ compHandleMarkedWindows(WindowPtr pWin, WindowPtr pLayerWin) | |||
| int | ||||
| compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update) | ||||
| { | ||||
|     BUG_RETURN_VAL(!pClient, BadMatch); | ||||
| 
 | ||||
|     CompWindowPtr cw = GetCompWindow(pWin); | ||||
|     CompClientWindowPtr ccw; | ||||
|     CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen); | ||||
|  | @ -323,6 +327,8 @@ compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update) | |||
|     CompWindowPtr cw = GetCompWindow(pWin); | ||||
|     CompClientWindowPtr ccw; | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pClient, BadValue); | ||||
| 
 | ||||
|     if (!cw) | ||||
|         return BadValue; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue