Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2013 07:44:10 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r257945 - head/usr.sbin/pkg
Message-ID:  <201311110744.rAB7iA6g041490@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon Nov 11 07:44:09 2013
New Revision: 257945
URL: http://svnweb.freebsd.org/changeset/base/257945

Log:
  Do not use just freed memory.
  
  Sponsored by:	Nginx, Inc.

Modified:
  head/usr.sbin/pkg/pkg.c

Modified: head/usr.sbin/pkg/pkg.c
==============================================================================
--- head/usr.sbin/pkg/pkg.c	Mon Nov 11 06:22:29 2013	(r257944)
+++ head/usr.sbin/pkg/pkg.c	Mon Nov 11 07:44:09 2013	(r257945)
@@ -323,9 +323,9 @@ parse_fingerprint(yaml_document_t *doc, 
 static void
 free_fingerprint_list(struct fingerprint_list* list)
 {
-	struct fingerprint* fingerprint;
+	struct fingerprint *fingerprint, *tmp;
 
-	STAILQ_FOREACH(fingerprint, list, next) {
+	STAILQ_FOREACH_SAFE(fingerprint, list, next, tmp) {
 		if (fingerprint->name)
 			free(fingerprint->name);
 		free(fingerprint);



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