https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ca2bb9ee2852313935a1a…
commit ca2bb9ee2852313935a1a5e1399a06adc5a562dc
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Sun Aug 26 03:05:46 2018 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sat Dec 8 17:38:16 2018 +0100
[LOG2LINES] Optimize malloc() calls.
---
sdk/tools/log2lines/options.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sdk/tools/log2lines/options.c b/sdk/tools/log2lines/options.c
index 0bcbf068dc..8fb9bb2b7c 100644
--- a/sdk/tools/log2lines/options.c
+++ b/sdk/tools/log2lines/options.c
@@ -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 ++;