Merge pull request #1099 from urbit/fix-mount-sync

fix (my own) use-after-free in unix dir/file watch
This commit is contained in:
Joe Bryan 2018-12-10 18:16:09 -05:00 committed by GitHub
commit 5bb9cacf6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -371,6 +371,8 @@ _unix_scan_mount_point(u3_umon* mon_u)
_unix_watch_file(fil_u, &mon_u->dir_u, pax_c);
}
}
free(pax_c);
}
}
}
@ -590,7 +592,8 @@ _unix_watch_file(u3_ufil* fil_u, u3_udir* par_u, c3_c* pax_c)
fil_u->dir = c3n;
fil_u->dry = c3n;
fil_u->pax_c = pax_c;
fil_u->pax_c = c3_malloc(1 + strlen(pax_c));
strcpy(fil_u->pax_c, pax_c);
fil_u->par_u = par_u;
fil_u->nex_u = NULL;
fil_u->mug_w = 0;
@ -627,7 +630,8 @@ _unix_watch_dir(u3_udir* dir_u, u3_udir* par_u, c3_c* pax_c)
dir_u->dir = c3y;
dir_u->dry = c3n;
dir_u->pax_c = pax_c;
dir_u->pax_c = c3_malloc(1 + strlen(pax_c));
strcpy(dir_u->pax_c, pax_c);
dir_u->par_u = par_u;
dir_u->nex_u = NULL;
dir_u->kid_u = NULL;