Commit 7be9485c by Michael Santos Committed by Daniel Lezcano

Exit if allocation fails

parent c232d084
......@@ -69,6 +69,10 @@ int main(int argc, char *argv[])
return -1;
regexp = malloc(strlen(my_args.name) + 3);
if (!regexp) {
ERROR("failed to allocate memory");
return -1;
}
sprintf(regexp, "^%s$", my_args.name);
if (regcomp(&preg, regexp, REG_NOSUB|REG_EXTENDED)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment