mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 06:16:03 +00:00
convert a malloc/strcpy to just a straight strdup().
This commit is contained in:
@@ -195,12 +195,12 @@ int add_search_dir(char *dir)
|
||||
if (!dir || strlen(dir) <= 0)
|
||||
return 1;
|
||||
|
||||
t = malloc(strlen(dir) + 1);
|
||||
t = strdup(dir);
|
||||
if (t == NULL) {
|
||||
PERROR(_("Error: Could not allocate memory.\n"));
|
||||
return 0;
|
||||
}
|
||||
strcpy(t, dir);
|
||||
|
||||
/*strip trailing /'s */
|
||||
while (t[strlen(t) - 1] == '/')
|
||||
t[strlen(t) - 1] = 0;
|
||||
|
Reference in New Issue
Block a user