All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: "Wei,Jiangang" <weijg.fnst@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH 2/5] kernel/syscalls/ipc/lib: Don't allocate memory for getpwnam()
Date: Thu, 7 May 2015 15:21:07 +0200	[thread overview]
Message-ID: <20150507132107.GC28637@rei.suse.de> (raw)
In-Reply-To: <1430897176-16486-2-git-send-email-weijg.fnst@cn.fujitsu.com>

Hi!
>  int getuserid(char *user)
>  {
> -	struct passwd *ent;
> -
> -	/* allocate some space for the passwd struct */
> -	if ((ent = malloc(sizeof(struct passwd))) == NULL) {
> -		tst_brkm(TBROK, cleanup, "couldn't allocate space for passwd"
> -			 " structure");
> -	}
> +	struct passwd *ent = NULL;

Why do you initialize the pointer with NULL? If it's only used to store
the return from getpwnam()...

Otherwise, this is a good catch :)

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2015-05-07 13:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06  7:26 [LTP] [PATCH 1/5] kernel/syscalls/mmap: remove unused cleanup() Wei,Jiangang
2015-05-06  7:26 ` [LTP] [PATCH 2/5] kernel/syscalls/ipc/lib: Don't allocate memory for getpwnam() Wei,Jiangang
2015-05-07 13:21   ` Cyril Hrubis [this message]
2015-05-08  3:28     ` [LTP] [PATCH v2 " Wei,Jiangang
2015-05-06  7:26 ` [LTP] [PATCH 3/5] kernel/mem/hugetlb/lib: " Wei,Jiangang
2015-05-07 13:21   ` Cyril Hrubis
2015-05-08  3:31     ` [LTP] [PATCH v2 " Wei,Jiangang
2015-05-08  8:33     ` [LTP] [PATCH v3 3/5] kernel/mem/hugetlb/lib: do refactor for getuserid Wei,Jiangang
2015-05-06  7:26 ` [LTP] [PATCH 4/5] kernel/syscalls/dup2: free fildes to avoid memory leak Wei,Jiangang
2015-05-07 13:26   ` Cyril Hrubis
2015-05-08  3:33     ` [LTP] [PATCH v2 4/5] kernel/syscalls/dup2: optimize allocation and free Wei,Jiangang
2015-05-06  7:26 ` [LTP] [PATCH 5/5] kernel/syscalls/fallocate: move fclose out of if-block Wei,Jiangang
2015-05-07 13:32   ` Cyril Hrubis
2015-05-08  3:39     ` [LTP] [PATCH v2 5/5] kernel/syscalls/fallocate: adjust fclose's position Wei,Jiangang
2015-05-07 13:22 ` [LTP] [PATCH 1/5] kernel/syscalls/mmap: remove unused cleanup() Cyril Hrubis

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=20150507132107.GC28637@rei.suse.de \
    --to=chrubis@suse.cz \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=weijg.fnst@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.