[CRIU] [PATCH] tty: prefer zalloc to malloc for inverted_path	allocation
    Dmitry Safonov 
    dsafonov at virtuozzo.com
       
    Thu Jun 23 04:00:12 PDT 2016
    
    
  
Otherwise, we copy original name to slash and after it there may stay
some junk, which strcat will use for concatenation:
(00.024843)     26: Error (files-reg.c:1528): Can't open file dev/pts/g:��ptmx on restore: No such file or directory
(00.024846)     26: Error (files-reg.c:1470): Can't open file dev/pts/g:��ptmx: No such file or directory
(00.024849)     26: Error (tty.c:545): tty: Can't open dev/pts/g:��ptmx: No such file or directory
Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/criu/tty.c b/criu/tty.c
index 302dd54528bf..243c5d3416ef 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -480,7 +480,7 @@ static struct reg_file_info *pty_alloc_fake_reg(struct tty_info *info, int subty
 		char *pos = strrchr(orig->rfe->name, '/');
 		size_t len = strlen(orig->rfe->name) + 1;
 		size_t slash_at = pos - orig->rfe->name;
-		char *inverted_path = xmalloc(len + 32);
+		char *inverted_path = xzalloc(len + 32);
 
 		BUG_ON(!pos || !inverted_path);
 
-- 
2.9.0
    
    
More information about the CRIU
mailing list