drw.c: Avoid potential memory leak in drw_cur_create()
If drw was NULL, memory was still allocated for cur.
This commit is contained in:
		
				
					committed by
					
						 Markus Teich
						Markus Teich
					
				
			
			
				
	
			
			
			
						parent
						
							243c8cf7b6
						
					
				
				
					commit
					996a4c5c6e
				
			
							
								
								
									
										4
									
								
								drw.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								drw.c
									
									
									
									
									
								
							| @ -396,9 +396,9 @@ drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, | ||||
|  | ||||
| Cur * | ||||
| drw_cur_create(Drw *drw, int shape) { | ||||
| 	Cur *cur = (Cur *)calloc(1, sizeof(Cur)); | ||||
| 	Cur *cur; | ||||
|  | ||||
| 	if(!drw || !cur) | ||||
| 	if(!drw || !(cur = (Cur *)calloc(1, sizeof(Cur)))) | ||||
| 		return NULL; | ||||
| 	cur->cursor = XCreateFontCursor(drw->dpy, shape); | ||||
| 	return cur; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user