2
0
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:
Steve Beattie
2007-05-24 22:07:39 +00:00
parent c2d927e710
commit f442a50a4d

View File

@@ -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;