Ensure copied is not overwritten by another strdup causing a leak

This commit is contained in:
Paulo Matos 2019-02-13 15:52:03 +01:00 committed by Matthew Flatt
parent e7e9d02c9e
commit 04e6422c72

View File

@ -915,6 +915,7 @@ int rktio_make_directory(rktio_t *rktio, const char *filename)
/* Make sure path doesn't have trailing separator: */
len = strlen(filename);
while (len && IS_A_SEP(filename[len - 1])) {
if (!copied)
copied = MSC_IZE(strdup)(filename);
copied[--len] = 0;
filename = copied;