Use xmalloc instead of malloc
Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
committed by
Junio C Hamano
parent
ef1186228d
commit
2d7320d0b0
4
config.c
4
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",
|
||||
|
||||
Reference in New Issue
Block a user