All of lore.kernel.org
 help / color / mirror / Atom feed
* master - coverity: check malloc results
@ 2017-06-27 10:20 Zdenek Kabelac
  0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2017-06-27 10:20 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8e790702f12ddcb730f8dc43d3fdccf08e62aa45
Commit:        8e790702f12ddcb730f8dc43d3fdccf08e62aa45
Parent:        e907535ab977ea29319aeb015cec6c06729f7ce4
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Tue Jun 27 10:18:00 2017 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Tue Jun 27 12:15:42 2017 +0200

coverity: check malloc results

---
 tools/command.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/command.c b/tools/command.c
index a08d068..b8b38ad 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -743,7 +743,11 @@ static void add_oo_definition_line(const char *name, const char *line)
 	char *start;
 
 	oo = &oo_lines[oo_line_count++];
-	oo->name = dm_strdup(name);
+
+	if (!(oo->name = dm_strdup(name))) {
+		log_error("Failer to duplicate name %s.", name);
+		return; /* FIXME: return code */
+	}
 
 	if ((colon = strchr(oo->name, ':')))
 		*colon = '\0';
@@ -753,7 +757,10 @@ static void add_oo_definition_line(const char *name, const char *line)
 	}
 
 	start = strchr(line, ':') + 2;
-	oo->line = dm_strdup(start);
+	if (!(oo->line = dm_strdup(start))) {
+		log_error("Failer to duplicate line %s.", start);
+		return;
+	}
 }
 
 /* Support OO_FOO: continuing on multiple lines. */



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-27 10:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 10:20 master - coverity: check malloc results Zdenek Kabelac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.