PERFORCE change 166183 for review

Gabor Pali pgj at FreeBSD.org
Thu Jul 16 23:13:11 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=166183

Change 166183 by pgj at 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);
 }
 


More information about the p4-projects mailing list