From 1594b1167de4f7d152aeb62b21c6bcc1855601b2 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Thu, 14 Nov 2019 13:05:47 +0100 Subject: [PATCH] muscle: Initialize variables and check return codes --- src/libopensc/muscle-filesystem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libopensc/muscle-filesystem.c b/src/libopensc/muscle-filesystem.c index ab5b6408..b18d057c 100644 --- a/src/libopensc/muscle-filesystem.c +++ b/src/libopensc/muscle-filesystem.c @@ -207,10 +207,13 @@ int mscfs_check_selection(mscfs_t *fs, int requiredItem) int mscfs_loadFileInfo(mscfs_t* fs, const u8 *path, int pathlen, mscfs_file_t **file_data, int* idx) { - msc_id fullPath; - int x; + msc_id fullPath = {{0, 0, 0, 0}}; + int x, rc; assert(fs != NULL && path != NULL && file_data != NULL); - mscfs_lookup_path(fs, path, pathlen, &fullPath, 0); + rc = mscfs_lookup_path(fs, path, pathlen, &fullPath, 0); + if (rc != SC_SUCCESS) { + return rc; + } /* Obtain file information while checking if it exists */ mscfs_check_cache(fs);