[LOG2LINES] Optimize malloc() calls.

This commit is contained in:
Serge Gautherie 2018-08-26 03:05:46 +02:00 committed by Hermès Bélusca-Maïto
parent dbaa875f05
commit ca2bb9ee28
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -96,8 +96,8 @@ int optionInit(int argc, const char **argv)
strcpy(opt_logFile, argv[i+1]);
break;
case 'P':
free(opt_Pipe);
opt_Pipe = malloc(LINESIZE);
if (!opt_Pipe)
opt_Pipe = malloc(LINESIZE);
strcpy(opt_Pipe, argv[i+1]);
break;
case 'z':
@ -166,8 +166,8 @@ int optionParse(int argc, const char **argv)
break;
case 'R':
optCount++;
free(opt_Revision);
opt_Revision = malloc(LINESIZE);
if (!opt_Revision)
opt_Revision = malloc(LINESIZE);
sscanf(optarg, "%s", opt_Revision);
if (strcmp(opt_Revision, "check") == 0)
opt_Revision_check ++;