Skip to contentSkip to conversation

perf script: remove some bogus error handling

PATCH New Dan Carpenter 2 participants 2 messages Jul 22, 2017 – Jul 26, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf script: remove some bogus error handling

If script_desc__new() fails then the current code has a NULL dereference. We don't actually need to do any cleanup, we can just return NULL.

tools/perf/builtin-script.c +1 -6
index 83cdc0a61fd6..89ea2bc9b9be 100644
@@ -2199,16 +2199,11 @@ static struct script_desc *script_desc__findnew(const char *name)
 
 	s = script_desc__new(name);
 	if (!s)
-		goto out_delete_desc;
+		return NULL;
 
 	script_desc__add(s);
 
 	return s;
-
-out_delete_desc:
-	script_desc__delete(s);
-
-	return NULL;
 }
 
 static const char *ends_with(const char *str, const char *suffix)
#1 lore raw

[tip:perf/core] perf script: Remove some bogus error handling

perf script: Remove some bogus error handling
Commit-ID:  2ec5cab604b2bbc5abe7138b537199762bea59ce
Gitweb:     http://git.kernel.org/tip/2ec5cab604b2bbc5abe7138b537199762bea59ce
Author:     Dan Carpenter <[email protected]>
AuthorDate: Sat, 22 Jul 2017 10:36:10 +0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 25 Jul 2017 22:43:17 -0300

perf script: Remove some bogus error handling

If script_desc__new() fails then the current code has a NULL dereference. We don't actually need to do any cleanup, we can just return NULL.

---
 tools/perf/builtin-script.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
tools/perf/builtin-script.c +1 -6
index d430ff4..378f76c 100644
@@ -2199,16 +2199,11 @@ static struct script_desc *script_desc__findnew(const char *name)
 
 	s = script_desc__new(name);
 	if (!s)
-		goto out_delete_desc;
+		return NULL;
 
 	script_desc__add(s);
 
 	return s;
-
-out_delete_desc:
-	script_desc__delete(s);
-
-	return NULL;
 }
 
 static const char *ends_with(const char *str, const char *suffix)