svn commit: r337814 - head/tests/sys/kqueue/libkqueue

Renato Botelho garga.bsd at gmail.com
Tue Aug 14 19:58:36 UTC 2018


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 at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscribe at freebsd.org"
> 


-- 
Renato Botelho


More information about the svn-src-head mailing list