You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/02/23 21:48:20 UTC

svn commit: r1449405 - /subversion/trunk/subversion/libsvn_ra_serf/update.c

Author: rhuijben
Date: Sat Feb 23 20:48:20 2013
New Revision: 1449405

URL: http://svn.apache.org/r1449405
Log:
* subversion/libsvn_ra_serf/update.c
  (fetch_file): Don't segfault on using uninitialized data when a server doesn't
     send a checksum.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/update.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1449405&r1=1449404&r2=1449405&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Sat Feb 23 20:48:20 2013
@@ -1497,8 +1497,8 @@ fetch_file(report_context_t *ctx, report
       if (ctx->sess->wc_callbacks->get_wc_contents
           && (info->final_sha1_checksum || info->final_checksum))
         {
-          svn_error_t *err;
-          svn_checksum_t *checksum;
+          svn_error_t *err = NULL;
+          svn_checksum_t *checksum = NULL;
          
           /* Parse our checksum, preferring SHA1 to MD5. */
           if (info->final_sha1_checksum)
@@ -1516,11 +1516,14 @@ fetch_file(report_context_t *ctx, report
 
           /* Okay so far?  Let's try to get a stream on some readily
              available matching content. */
-          if (!err)
+          if (!err && checksum)
             {
               err = ctx->sess->wc_callbacks->get_wc_contents(
                         ctx->sess->wc_callback_baton, &contents,
                         checksum, info->pool);
+
+              if (! err)
+                info->cached_contents = contents;
             }
 
           if (err)
@@ -1529,11 +1532,7 @@ fetch_file(report_context_t *ctx, report
                  errorful state, but this codepath is optional.  */
               svn_error_clear(err);
             }
-          else
-            {
-              info->cached_contents = contents;
-            }
-        }          
+        }
 
       /* If the working copy can provide cached contents for this
          file, we don't have to fetch them from the server. */