Code

Add has_symlink_leading_path() function.
[git.git] / diffcore-pickaxe.c
index cfcce315babb0edb7ad7be7f2ab2437aaf41eb9d..c4a77d71da5602b68c541c2487fcbecfdfff2944 100644 (file)
@@ -5,8 +5,6 @@
 #include "diff.h"
 #include "diffcore.h"
 
-#include <regex.h>
-
 static unsigned int contains(struct diff_filespec *one,
                             const char *needle, unsigned long len,
                             regex_t *regexp)
@@ -16,6 +14,8 @@ static unsigned int contains(struct diff_filespec *one,
        const char *data;
        if (diff_populate_filespec(one, 0))
                return 0;
+       if (!len)
+               return 0;
 
        sz = one->size;
        data = one->data;
@@ -44,6 +44,7 @@ static unsigned int contains(struct diff_filespec *one,
                        }
                }
        }
+       diff_free_filespec_data(one);
        return cnt;
 }