xf86OutputRename: Replace another strlen/malloc/strcpy set with strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
		
							parent
							
								
									d346bc3083
								
							
						
					
					
						commit
						29e467a1f1
					
				| 
						 | 
				
			
			@ -660,13 +660,11 @@ xf86OutputCreate (ScrnInfoPtr		    scrn,
 | 
			
		|||
Bool
 | 
			
		||||
xf86OutputRename (xf86OutputPtr output, const char *name)
 | 
			
		||||
{
 | 
			
		||||
    int	    len = strlen(name) + 1;
 | 
			
		||||
    char    *newname = malloc(len);
 | 
			
		||||
    char    *newname = strdup(name);
 | 
			
		||||
    
 | 
			
		||||
    if (!newname)
 | 
			
		||||
	return FALSE;	/* so sorry... */
 | 
			
		||||
    
 | 
			
		||||
    strcpy (newname, name);
 | 
			
		||||
    if (output->name && output->name != (char *) (output + 1))
 | 
			
		||||
	free(output->name);
 | 
			
		||||
    output->name = newname;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue