commit d6fca0ba38c4b10064f9b966ab286a63acaf9ce9 from: Hiltjo Posthuma date: Sun Sep 15 11:51:17 2019 UTC check calloc() for NULL return value commit - 25dced9b436467b3d008cf5e63d7414cd6ea7239 commit + d6fca0ba38c4b10064f9b966ab286a63acaf9ce9 blob - 2882ec45e57417dc6535ad0d2db736c180bfde42 blob + 6ee2cf18dd546e0cff7500a322d3710b0ad60ced --- lib/repository.c +++ lib/repository.c @@ -1428,6 +1428,8 @@ import_subdir(struct got_tree_entry **new_te, struct d return got_error_from_errno("asprintf"); (*new_te) = calloc(1, sizeof(**new_te)); + if (*new_te == NULL) + return got_error_from_errno("calloc"); (*new_te)->mode = S_IFDIR; (*new_te)->name = strdup(de->d_name); if ((*new_te)->name == NULL) { blob - 9ccc0f4caee926967fe680a36d48c59f39910e07 blob + 5f97bf0aeacce20bc0aea86e5a9c00ef6391963c --- lib/worktree.c +++ lib/worktree.c @@ -3745,6 +3745,8 @@ make_subtree_for_added_blob(struct got_tree_entry **ne return got_error_from_errno("asprintf"); new_te = calloc(1, sizeof(*new_te)); + if (new_te == NULL) + return got_error_from_errno("calloc"); new_te->mode = S_IFDIR; new_te->name = strdup(child_path); if (new_te->name == NULL) {