Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2018 16:58:30 -0300
From:      Renato Botelho <garga.bsd@gmail.com>
To:        David Bright <dab@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r337814 - head/tests/sys/kqueue/libkqueue
Message-ID:  <98e8803a-1677-066a-6e50-a0183bd93f53@gmail.com>
In-Reply-To: <201808141931.w7EJV77D081255@repo.freebsd.org>
References:  <201808141931.w7EJV77D081255@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 14/08/18 16:31, David Bright wrote:
> Author: dab
> Date: Tue Aug 14 19:31:06 2018
> New Revision: 337814
> URL: https://svnweb.freebsd.org/changeset/base/337814
> 
> Log:
>   Fix several (more) memory leaks.
>   
>   A follow-up to r337812 to catch a couple more memory leaks that should
>   have been included in that change.
>   
>   Reported by:	Coverity
>   CID:		1296064, 1296067 (for real this time)
>   MFC after:	3 days
>   X-MFC-with:	r337812
>   Sponsored by:	Dell EMC
> 
> Modified:
>   head/tests/sys/kqueue/libkqueue/main.c
> 
> Modified: head/tests/sys/kqueue/libkqueue/main.c
> ==============================================================================
> --- head/tests/sys/kqueue/libkqueue/main.c	Tue Aug 14 19:21:31 2018	(r337813)
> +++ head/tests/sys/kqueue/libkqueue/main.c	Tue Aug 14 19:31:06 2018	(r337814)
> @@ -235,10 +235,14 @@ kevent_add(int kqfd, struct kevent *kev, 
>          intptr_t  data,
>          void      *udata)
>  {
> +    char *kev_str;
> +    
>      EV_SET(kev, ident, filter, flags, fflags, data, NULL);    
>      if (kevent(kqfd, kev, 1, NULL, 0, NULL) < 0) {
> -        printf("Unable to add the following kevent:\n%s\n",
> -                kevent_to_str(kev));
> +        kev_str = kevent_to_str(kev);

It seems that this line is indented with spaces instead of TABs

> +	printf("Unable to add the following kevent:\n%s\n",
> +                kev_str);
> +	free(kev_str);
>          err(1, "kevent(): %s", strerror(errno));
>      }
>  }
> @@ -246,6 +250,9 @@ kevent_add(int kqfd, struct kevent *kev, 
>  void
>  kevent_cmp(struct kevent *k1, struct kevent *k2)
>  {
> +    char *kev1_str;
> +    char *kev2_str;
> +    
>  /* XXX-
>     Workaround for inconsistent implementation of kevent(2) 
>   */
> @@ -258,8 +265,12 @@ kevent_cmp(struct kevent *k1, struct kevent *k2)
>        k1->data != k2->data || k1->udata != k2->udata ||
>        k1->ext[0] != k2->ext[0] || k1->ext[1] != k2->ext[1] ||
>        k1->ext[0] != k2->ext[2] || k1->ext[0] != k2->ext[3]) {
> +        kev1_str = kevent_to_str(k1);

Same here

> +	kev2_str = kevent_to_str(k2);
>          printf("kevent_cmp: mismatch:\n  %s !=\n  %s\n", 
> -              kevent_to_str(k1), kevent_to_str(k2));
> +	       kev1_str, kev2_str);
> +	free(kev1_str);
> +	free(kev2_str);
>          abort();
>      }
>  }
> _______________________________________________
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"
> 


-- 
Renato Botelho



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?98e8803a-1677-066a-6e50-a0183bd93f53>