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
2e1b5200e9
commit
ef74488e54
@ -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