linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Scott Wood <scottwood@freescale.com>
Cc: linuxppc-dev@ozlabs.org, jdl@jdl.com
Subject: Re: [PATCH 2/3] Handle absolute pathnames correctly in dtc_open_file.
Date: Sun, 6 Jan 2008 14:37:16 +1100	[thread overview]
Message-ID: <20080106033716.GL4326@localhost.localdomain> (raw)
In-Reply-To: <20080104211045.GB28991@ld0162-tx32.am.freescale.net>

On Fri, Jan 04, 2008 at 03:10:45PM -0600, Scott Wood wrote:
> Also, free file->dir when freeing file.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
>  srcpos.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/srcpos.c b/srcpos.c
> index 7340c33..7a0c47e 100644
> --- a/srcpos.c
> +++ b/srcpos.c
> @@ -86,6 +86,16 @@ struct dtc_file *dtc_open_file(const char *fname,
>  		return file;
>  	}
>  
> +	if (fname[0] == '/') {
> +		file->file = fopen(fname, "r");
> +
> +		if (!file->file)
> +			goto out;
> +
> +		file->name = strdup(fname);
> +		return file;
> +	}
> +
>  	if (!search)
>  		search = &default_search;
>  
> @@ -100,6 +110,7 @@ struct dtc_file *dtc_open_file(const char *fname,
>  	}
>  
>  out:
> +	free((void *)file->dir);

That cast shouldn't be there.

>  	free(file);
>  	return NULL;
>  }
> @@ -109,5 +120,6 @@ void dtc_close_file(struct dtc_file *file)
>  	if (fclose(file->file))
>  		die("Error closing \"%s\": %s\n", file->name, strerror(errno));
>  
> +	free((void *)file->dir);

Or here.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  reply	other threads:[~2008-01-06  3:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-04 21:10 [PATCH 2/3] Handle absolute pathnames correctly in dtc_open_file Scott Wood
2008-01-06  3:37 ` David Gibson [this message]
2008-01-06 22:46   ` Scott Wood
2008-01-07 15:25     ` Jon Loeliger
2008-01-10  5:09     ` David Gibson
2008-01-07 15:22 ` Jon Loeliger

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=20080106033716.GL4326@localhost.localdomain \
    --to=david@gibson.dropbear.id.au \
    --cc=jdl@jdl.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=scottwood@freescale.com \
    /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).