Fix users of prefix_path() to free() only when necessary
[git.git] / config.c
index 4773414..41066e4 100644 (file)
--- a/config.c
+++ b/config.c
@@ -335,8 +335,11 @@ static int store_aux(const char* key, const char* value)
                        store.offset[store.seen] = ftell(config_file);
                        store.state = KEY_SEEN;
                        store.seen++;
-               } else if(!strncmp(key, store.key, store.baselen))
-                       store.state = SECTION_SEEN;
+               } else if (strrchr(key, '.') - key == store.baselen &&
+                             !strncmp(key, store.key, store.baselen)) {
+                                       store.state = SECTION_SEEN;
+                                       store.offset[store.seen] = ftell(config_file);
+               }
        }
        return 0;
 }