]> git.ipfire.org Git - thirdparty/git.git/blobdiff - config.c
Use xmalloc instead of malloc
[thirdparty/git.git] / config.c
index d9f2b787b94f2506ff7842c1b7b06bd15342ba6f..c0897cc8076cfa62cd7e5b41513ae33c28e53dde 100644 (file)
--- a/config.c
+++ b/config.c
@@ -565,7 +565,7 @@ int git_config_set_multivar(const char* key, const char* value,
        /*
         * Validate the key and while at it, lower case it for matching.
         */
-       store.key = (char*)malloc(strlen(key)+1);
+       store.key = xmalloc(strlen(key) + 1);
        dot = 0;
        for (i = 0; key[i]; i++) {
                unsigned char c = key[i];
@@ -633,7 +633,7 @@ int git_config_set_multivar(const char* key, const char* value,
                        } else
                                store.do_not_match = 0;
 
-                       store.value_regex = (regex_t*)malloc(sizeof(regex_t));
+                       store.value_regex = (regex_t*)xmalloc(sizeof(regex_t));
                        if (regcomp(store.value_regex, value_regex,
                                        REG_EXTENDED)) {
                                fprintf(stderr, "Invalid pattern: %s\n",