From 79e0b37c4e4e33d4f70141dd6197795641cd46ac Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Sun, 29 Mar 2015 19:24:07 +0200 Subject: [PATCH] parse_mountinfo_ent: xrealloc(new->mountpoint) can fail This is pure theoretical, especially in this particular case when we actually want to (likely) free the unused memory. Still the code which ignores potential error doesn't look good. Signed-off-by: Oleg Nesterov Reviewed-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- proc_parse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proc_parse.c b/proc_parse.c index 744121249..ce0ececa5 100644 --- a/proc_parse.c +++ b/proc_parse.c @@ -962,6 +962,8 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname) goto err; new->mountpoint = xrealloc(new->mountpoint, strlen(new->mountpoint) + 1); + if (!new->mountpoint) + goto err; new->s_dev = MKKDEV(kmaj, kmin); new->flags = 0;