read_index_from(): catch out of order entries when reading an index file
[gitweb.git] / builtin / mv.c
index f4d89d06408be1fabf964000b18fa8204a9bb3a4..180ef99127d47d0e8fe9f12a590fd9ba9e524f08 100644 (file)
@@ -162,7 +162,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                                        if (strncmp(path, src_w_slash, len_w_slash))
                                                break;
                                }
-                               free((char *)src_w_slash);
+                               if (src_w_slash != src)
+                                       free((char *)src_w_slash);
 
                                if (last - first < 1)
                                        bad = _("source directory is empty");