*** client.c	2009-10-29 08:47:16.000000000 +0100
--- client_fixed.c	2009-12-15 18:33:01.000000000 +0100
***************
*** 4243,4248 ****
--- 4243,4251 ----
  	}
  
  	if (info.count == 2) {
+ 		
+ 		char *pathfix;
+ 
  		/*
  		 * Exactly one match in matches[1], indicate this is the one
  		 * in matches[0].
***************
*** 4250,4255 ****
--- 4253,4267 ----
  		info.matches[0] = info.matches[1];
  		info.matches[1] = NULL;
  		info.count -= 1;
+ 		
+ 		// XXX HACK (Fix tab completion to work with spaces in path)
+ 		i=strlen(info.matches[0]);
+ 		pathfix = SMB_MALLOC_ARRAY(char, i+2);
+ 		pathfix[0]='"';	//It is enough to add " at beggining. 
+ 		safe_strcpy(&pathfix[1],info.matches[0],i);
+ 		SAFE_FREE(info.matches[0]);
+ 		info.matches[0]=pathfix;		
+ 
  		TALLOC_FREE(ctx);
  		return info.matches;
  	}
***************
*** 4261,4266 ****
--- 4273,4281 ----
  
  	info.matches[0] = SMB_STRNDUP(info.matches[1], info.samelen);
  	info.matches[info.count] = NULL;
+ 
+ 	TALLOC_FREE(ctx); // XXX Fixed memory leak
+ 	
  	return info.matches;
  
  cleanup:

