changeset 12658:9335f5b5795a

csv: Fix corrupted command field in CSV summary with --abr-ladder option
author Aruna Matheswaran <aruna@multicorewareinc.com>
date Tue, 12 May 2020 11:40:21 +0530
parents 1e3dbf09ee4f
children d5695e28999e
files source/x265.cpp source/x265cli.cpp source/x265cli.h
diffstat 3 files changed, 12 insertions(+-), 2 deletions(-) [+]
line wrap: on
line diff
--- a/source/x265.cpp	Wed May 06 18:40:34 2020 +0530
+++ b/source/x265.cpp	Tue May 12 11:40:21 2020 +0530
@@ -173,7 +173,8 @@ static bool parseAbrConfig(FILE* abrConf
         char *id = strtok(header, ":");
         char *head[X265_HEAD_ENTRIES];
         cliopt[i].encId = i;
- 
+        cliopt[i].isAbrLadderConfig = true;
+
         while (id && (idCount <= X265_HEAD_ENTRIES))
         {
             head[idCount] = id;
@@ -195,7 +196,7 @@ static bool parseAbrConfig(FILE* abrConf
         char* token = strtok(start, " ");
         while (token)
         {
-            argv[argc++] = token;
+            argv[argc++] = strdup(token);
             token = strtok(NULL, " ");
         }
         argv[argc] = NULL;
--- a/source/x265cli.cpp	Wed May 06 18:40:34 2020 +0530
+++ b/source/x265cli.cpp	Tue May 12 11:40:21 2020 +0530
@@ -370,6 +370,13 @@ namespace X265_NS {
 
     void CLIOptions::destroy()
     {
+        if (isAbrLadderConfig)
+        {
+            for (int idx = 1; idx < argCnt; idx++)
+                free(argString[idx]);
+            free(argString);
+        }
+
         if (input)
             input->release();
         input = NULL;
--- a/source/x265cli.h	Wed May 06 18:40:34 2020 +0530
+++ b/source/x265cli.h	Tue May 12 11:40:21 2020 +0530
@@ -405,6 +405,7 @@ static const struct option long_options[
         char** argString;
 
         /* ABR ladder settings */
+        bool isAbrLadderConfig;
         bool enableScaler;
         char*    encName;
         char*    reuseName;
@@ -435,6 +436,7 @@ static const struct option long_options[
             startTime = x265_mdate();
             prevUpdateTime = 0;
             bDither = false;
+            isAbrLadderConfig = false;
             enableScaler = false;
             encName = NULL;
             reuseName = NULL;