From b904926443820b8f088abcd1e2d7fd57bb9f943d Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 11 Oct 2015 16:11:02 +0200 Subject: [PATCH] Checking success of strdup(). Indirectly found by Coverity CID 12548. --- libisofs/tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libisofs/tree.c b/libisofs/tree.c index 9bc8a64..c392679 100644 --- a/libisofs/tree.c +++ b/libisofs/tree.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2007 Vreixo Formoso - * Copyright (c) 2011 - 2014 Thomas Schmitt + * Copyright (c) 2011 - 2015 Thomas Schmitt * * This file is part of the libisofs project; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 @@ -1199,6 +1199,8 @@ int iso_tree_path_to_node_flag(IsoImage *image, const char *path, } ptr = strdup(path); + if (ptr == NULL) + return ISO_OUT_OF_MEM; result = 0; /* get the first component of the path */