xkb: Fix memory leak if opening file fails
If fopen fails pointer in buf would be overwriten with a new pointer. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
		
							parent
							
								
									20cb9c923e
								
							
						
					
					
						commit
						1223340644
					
				| 
						 | 
					@ -161,6 +161,7 @@ char	tmpname[PATH_MAX];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!in) {
 | 
						if (!in) {
 | 
				
			||||||
	    haveDir= FALSE;
 | 
						    haveDir= FALSE;
 | 
				
			||||||
 | 
						    free(buf);
 | 
				
			||||||
	    buf = Xprintf(
 | 
						    buf = Xprintf(
 | 
				
			||||||
		"'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
 | 
							"'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
 | 
				
			||||||
                XkbBinDirectory,XkbBaseDirectory,componentDirs[what],(long)
 | 
					                XkbBinDirectory,XkbBaseDirectory,componentDirs[what],(long)
 | 
				
			||||||
| 
						 | 
					@ -176,6 +177,7 @@ char	tmpname[PATH_MAX];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!in) {
 | 
						if (!in) {
 | 
				
			||||||
	    haveDir= FALSE;
 | 
						    haveDir= FALSE;
 | 
				
			||||||
 | 
						    free(buf);
 | 
				
			||||||
	    buf = Xprintf(
 | 
						    buf = Xprintf(
 | 
				
			||||||
		"xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
 | 
							"xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
 | 
				
			||||||
                componentDirs[what],(long)
 | 
					                componentDirs[what],(long)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue