ctm: fix memory leaks in Pass1(..)
Call `Delete(..)` (a free(3) wrapper) on `name` when bailing from the function. Submitted by: Tom Rix <trix@juniper.net> Reviewed by: ngie Differential Revision: D10097 Sponsored by: Dell EMC Isilon, Juniper
This commit is contained in:
parent
e9517d2481
commit
84eb6b9887
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=315717
@ -114,6 +114,7 @@ Pass1(FILE *fd, unsigned applied)
|
||||
}
|
||||
if (name[0] == '/') {
|
||||
Fatal("Absolute paths are illegal.");
|
||||
Delete(name);
|
||||
return Exit_Mess;
|
||||
}
|
||||
q = name;
|
||||
@ -121,6 +122,7 @@ Pass1(FILE *fd, unsigned applied)
|
||||
if (q[0] == '.' && q[1] == '.')
|
||||
if (q[2] == '/' || q[2] == '\0') {
|
||||
Fatal("Paths containing '..' are illegal.");
|
||||
Delete(name);
|
||||
return Exit_Mess;
|
||||
}
|
||||
if ((q = strchr(q, '/')) == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user