From 3c0d56d0bda71baa61443c751bca98505bbd1b13 Mon Sep 17 00:00:00 2001 From: Lutz Mueller Date: Sun, 19 Aug 2001 12:19:57 +0000 Subject: [PATCH] =?UTF-8?q?2001-08-19=20=20Lutz=20M=EF=BF=BDller=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * libgphoto2/filesys.c (gp_filesystem_format): Fix bug found by St�phane Castejon. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@2012 67ed7778-7388-44ab-90cf-0a291f65f57c --- ChangeLog | 5 +++++ libgphoto2/filesys.c | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 88c994669..fe6222a17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-08-19 Lutz Müller + + * libgphoto2/filesys.c (gp_filesystem_format): Fix bug found by + Stéphane Castejon. + 2001-08-19 Lutz Müller * libgphoto2/globals.h: Unused. Removed. diff --git a/libgphoto2/filesys.c b/libgphoto2/filesys.c index ac038c386..74fe9ae98 100644 --- a/libgphoto2/filesys.c +++ b/libgphoto2/filesys.c @@ -330,15 +330,16 @@ gp_filesystem_format (CameraFilesystem *fs) { int x, y; - if (fs->folder) { - for (x = 0; x < fs->count; x++) { - for (y=0; yfolder[x]->count; y++) - free (fs->folder[x]->file[y]); - free (fs->folder[x]); - } - free (fs->folder); - } - fs->count = 0; + if (!fs) + return (GP_ERROR_BAD_PARAMETERS); + + for (x = 0; x < fs->count; x++) { + for (y = 0; y < fs->folder[x]->count; y++) + free (fs->folder[x]->file[y]); + free (fs->folder[x]); + } + free (fs->folder); + fs->count = 0; return (GP_OK); }