[patch mountd.c] replace malloc memset with calloc

2014-04-22 Thread peter

Hi,

Another malloc  memset to calloc cleanup. This time in mountd.c

Index: mountd.c
===
RCS file: /cvs/src/sbin/mountd/mountd.c,v
retrieving revision 1.73
diff -u -p -u -r1.73 mountd.c
--- mountd.c24 Mar 2014 00:19:48 -  1.73
+++ mountd.c22 Apr 2014 19:47:55 -
@@ -1057,10 +1057,9 @@ get_exp(void)
 {
struct exportlist *ep;

-   ep = (struct exportlist *)malloc(sizeof (struct exportlist));
+   ep = calloc(1, sizeof (struct exportlist));
if (ep == NULL)
out_of_mem();
-   memset(ep, 0, sizeof(struct exportlist));
return (ep);
 }

@@ -1072,10 +1071,9 @@ get_grp(void)
 {
struct grouplist *gp;

-   gp = (struct grouplist *)malloc(sizeof (struct grouplist));
+   gp = calloc(1, sizeof (struct grouplist));
if (gp == NULL)
out_of_mem();
-   memset(gp, 0, sizeof(struct grouplist));
return (gp);
 }



Re: [patch mountd.c] replace malloc memset with calloc

2014-04-22 Thread Ted Unangst
On Tue, Apr 22, 2014 at 15:49, pe...@petermalone.org wrote:
 Hi,
 
 Another malloc  memset to calloc cleanup. This time in mountd.c

Can you be careful about whitespace? Your diffs have spaces instead of
tabs and don't apply.

The ones you've sent I can hand apply, but for future diffs please
work out something that doesn't require me to do any typing. :)



Re: [patch mountd.c] replace malloc memset with calloc

2014-04-22 Thread Bob Beck
Note you can often have this problem if you cut and paste your diff
into a mail message

Normally best to use something that allows you to just include the
diff from a file inline.

To check it, mail *yourself* the diff. If you can save the email
message raw and apply the
diff just by running patch with the email as input, you're good.

On Tue, Apr 22, 2014 at 2:23 PM, Ted Unangst t...@tedunangst.com wrote:
 On Tue, Apr 22, 2014 at 15:49, pe...@petermalone.org wrote:
 Hi,

 Another malloc  memset to calloc cleanup. This time in mountd.c

 Can you be careful about whitespace? Your diffs have spaces instead of
 tabs and don't apply.

 The ones you've sent I can hand apply, but for future diffs please
 work out something that doesn't require me to do any typing. :)




Re: [patch mountd.c] replace malloc memset with calloc

2014-04-22 Thread peter
Damn it - that's my bad. I'll stop sending more of these patches (i  
have a lot) until I get that sorted.


Apologies!

Quoting Ted Unangst t...@tedunangst.com:


On Tue, Apr 22, 2014 at 15:49, pe...@petermalone.org wrote:

Hi,

Another malloc  memset to calloc cleanup. This time in mountd.c


Can you be careful about whitespace? Your diffs have spaces instead of
tabs and don't apply.

The ones you've sent I can hand apply, but for future diffs please
work out something that doesn't require me to do any typing. :)






Re: [patch mountd.c] replace malloc memset with calloc

2014-04-22 Thread peter

Thanks Bob. I'll do that.

Quoting Bob Beck b...@obtuse.com:


Note you can often have this problem if you cut and paste your diff
into a mail message

Normally best to use something that allows you to just include the
diff from a file inline.

To check it, mail *yourself* the diff. If you can save the email
message raw and apply the
diff just by running patch with the email as input, you're good.

On Tue, Apr 22, 2014 at 2:23 PM, Ted Unangst t...@tedunangst.com wrote:

On Tue, Apr 22, 2014 at 15:49, pe...@petermalone.org wrote:

Hi,

Another malloc  memset to calloc cleanup. This time in mountd.c


Can you be careful about whitespace? Your diffs have spaces instead of
tabs and don't apply.

The ones you've sent I can hand apply, but for future diffs please
work out something that doesn't require me to do any typing. :)