]> git.cworth.org Git - vogl/commitdiff
UI: separate capturing of vogl_gl_state_snapshot from allocation of the vogleditor_gl...
authorPeter Lohrmann <plohrmann@upsamplesoftware.com>
Fri, 14 Mar 2014 21:12:02 +0000 (14:12 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 1 Apr 2014 19:37:28 +0000 (12:37 -0700)
(cherry picked from commit 12ec6a58517055d2e460bfc0d06d1847931bf7d0)

src/vogleditor/vogleditor_tracereplayer.cpp

index bc5d4f3e8c2a60df98c8a6c40f6fd519212de32a..c7d826bd4cc65661c5f6d7c0c03dc501bd6cc8f0 100644 (file)
@@ -173,15 +173,20 @@ bool vogleditor_traceReplayer::recursive_replay_apicallTreeItem(vogleditor_apiCa
                {
                   vogl_printf("Taking snapshot on API call # %" PRIu64 "\n", apiCallNumber);
 
                {
                   vogl_printf("Taking snapshot on API call # %" PRIu64 "\n", apiCallNumber);
 
-                  *ppNewSnapshot = vogl_new(vogleditor_gl_state_snapshot, m_pTraceReplayer->snapshot_state());
-
-                  if (*ppNewSnapshot == NULL)
+                  vogl_gl_state_snapshot* pNewSnapshot = m_pTraceReplayer->snapshot_state();
+                  if (pNewSnapshot == NULL)
                   {
                   {
-                     vogl_error_printf("Snapshot failed!\n");
+                      vogl_error_printf("Taking new snapshot failed!\n");
                   }
                   else
                   {
                   }
                   else
                   {
-                      vogl_printf("Snapshot succeeded\n");
+                      vogl_printf("Taking snapshot succeeded\n");
+                      *ppNewSnapshot = vogl_new(vogleditor_gl_state_snapshot, pNewSnapshot);
+                      if (*ppNewSnapshot == NULL)
+                      {
+                         vogl_error_printf("Allocating memory for snapshot container failed!\n");
+                         vogl_delete(pNewSnapshot);
+                      }
                   }
 
                   bStatus = false;
                   }
 
                   bStatus = false;