Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jul 2009 23:13:09 GMT
From:      Gabor Pali <pgj@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 166183 for review
Message-ID:  <200907162313.n6GND9Jt051359@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=166183

Change 166183 by pgj@petymeg-current on 2009/07/16 23:12:28

	Fix socket_type_list iterator routines.

Affected files ...

.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#29 edit

Differences ...

==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#29 (text+ko) ====

@@ -278,7 +278,7 @@
 	/* XXX: Should it copy the list? */
 	itp->sti_list = list;
 	itp->sti_first = LIST_FIRST(&list->stl_list);
-	itp->sti_next = itp->sti_first;
+	itp->sti_next = LIST_NEXT(itp->sti_first, st_list);
 	*iterator = itp;
 	return (0);
 }
@@ -310,14 +310,9 @@
 	stp = malloc(sizeof(*stp));
 	if (stp == NULL)
 		return (NULL);
-	
-	iterator->sti_next = LIST_NEXT(iterator->sti_next, st_list);
-	if (iterator->sti_next == NULL) {
-		free(stp);
-		return (NULL);
-	}
 
 	memcpy(stp, iterator->sti_next, sizeof(*stp));
+	iterator->sti_next = LIST_NEXT(iterator->sti_next, st_list);
 	return (stp);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907162313.n6GND9Jt051359>