linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jim Meyering <jim@meyering.net>
To: linux-ext4@vger.kernel.org
Subject: [PATCH] * lib/ext2fs/dosio.c (dos_open): don't leak strdup'd dev name upon error
Date: Mon, 23 Feb 2009 17:47:30 +0100	[thread overview]
Message-ID: <874oyldrrx.fsf@meyering.net> (raw)


Signed-off-by: Jim Meyering <meyering@redhat.com>
---
Spotted by inspection.
For all I know, this is dead code ;-)

 lib/ext2fs/dosio.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/ext2fs/dosio.c b/lib/ext2fs/dosio.c
index 97ceef5..a7968cd 100644
--- a/lib/ext2fs/dosio.c
+++ b/lib/ext2fs/dosio.c
@@ -278,6 +278,7 @@ static errcode_t dos_open(const char *dev, int flags, io_channel *channel)
   if(!HW_OK())
   {
     _dio_error = ERR_HARDWARE;
+    free(part->dev);
     free(part);
     return EFAULT;
   }
@@ -297,6 +298,7 @@ static errcode_t dos_open(const char *dev, int flags, io_channel *channel)
   if(!HW_OK())
   {
     _dio_error = ERR_HARDWARE;
+    free(part->dev);
     free(part);
     return EFAULT;
   }
@@ -308,6 +310,7 @@ static errcode_t dos_open(const char *dev, int flags, io_channel *channel)
   {
     _dio_error = part->pno == 0xFE ? ERR_EMPTYPART :
                  part->pno == 0xFD ? ERR_LINUXSWAP : ERR_NOTEXT2FS;
+    free(part->dev);
     free(part);
     return ENODEV;
   }
--
1.6.2.rc1.266.g4bdf

             reply	other threads:[~2009-02-23 16:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-23 16:47 Jim Meyering [this message]
2009-03-09  0:40 ` [PATCH] * lib/ext2fs/dosio.c (dos_open): don't leak strdup'd dev name upon error Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874oyldrrx.fsf@meyering.net \
    --to=jim@meyering.net \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).