You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/02/27 12:08:50 UTC

svn commit: r1572512 - /subversion/trunk/subversion/libsvn_fs_fs/pack.c

Author: stefan2
Date: Thu Feb 27 11:08:50 2014
New Revision: 1572512

URL: http://svn.apache.org/r1572512
Log:
Fix a "condition depends on unitialized value" error found with valgrind.

* subversion/libsvn_fs_fs/pack.c
  (sort_reps_range): Assign REP_ID only where needed but make sure it
                     gets initialized, and to the first *relevant* entry.

Found by: kotkov

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/pack.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/pack.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/pack.c?rev=1572512&r1=1572511&r2=1572512&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/pack.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/pack.c Thu Feb 27 11:08:50 2014
@@ -884,7 +884,6 @@ sort_reps_range(pack_context_t *context,
         {
           /* next path */
           path = path_order[i]->path;
-          rep_id = path_order[i]->rep_id;
 
           /* Pick roundest non-linear deltified node. */
           if (roundness(path_order[best]->predecessor_count)
@@ -921,6 +920,15 @@ sort_reps_range(pack_context_t *context,
   for (i = first; i < last; ++i)
     if (path_order[i])
       {
+        /* This is the first path we still have to handle. */
+        path = path_order[i]->path;
+        rep_id = path_order[i]->rep_id;
+        break;
+      }
+
+  for (i = first; i < last; ++i)
+    if (path_order[i])
+      {
         /* New path? */
         if (svn_prefix_string__compare(path, path_order[i]->path))
           {