[PATCH i-g-t 3/5] runner/settings: Drop extra strdup
Lucas De Marchi
lucas.demarchi at intel.com
Fri Jan 17 23:17:44 UTC 2025
No need to strdup() again since the fscanf() function is already
allocating the variable. Just set the pointer to NULL so we "leak" our
variable to be saved in the settings.
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
runner/settings.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/runner/settings.c b/runner/settings.c
index 13694a51c..96377f1de 100644
--- a/runner/settings.c
+++ b/runner/settings.c
@@ -1164,7 +1164,11 @@ static unsigned long parse_ul(char **pval)
static char *parse_str(char **pval)
{
- return *pval ? strdup(*pval) : NULL;
+ char *ret = *pval;
+
+ *pval = NULL;
+
+ return ret;
}
#define PARSE_LINE(s, name, val, field, _f) \
--
2.48.0
More information about the igt-dev
mailing list