Commit dfda1cf507f91b53e73345c9053f6a61587db984

Jacques Germishuys 2014-12-27T21:04:28

Check for OOM

diff --git a/src/crlf.c b/src/crlf.c
index 9344876..c0a7399 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -345,6 +345,8 @@ static void crlf_cleanup(
 git_filter *git_crlf_filter_new(void)
 {
 	struct crlf_filter *f = git__calloc(1, sizeof(struct crlf_filter));
+	if (f == NULL)
+		return NULL;
 
 	f->f.version = GIT_FILTER_VERSION;
 	f->f.attributes = "crlf eol text";
diff --git a/src/ident.c b/src/ident.c
index 5163087..6bc80ab 100644
--- a/src/ident.c
+++ b/src/ident.c
@@ -115,6 +115,8 @@ static int ident_apply(
 git_filter *git_ident_filter_new(void)
 {
 	git_filter *f = git__calloc(1, sizeof(git_filter));
+	if (f == NULL)
+		return NULL;
 
 	f->version = GIT_FILTER_VERSION;
 	f->attributes = "+ident"; /* apply to files with ident attribute set */