Advertisement
iwishiknew

memleak.cpp

Jun 22nd, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.53 KB | None | 0 0
  1. int snapshot_menu(const basic_snap_data& snap, const int& num_of_snaps)
  2. {
  3.     int x = 0;
  4.     char ch;
  5.     chrono_date t; //time class...
  6.     fsys_class p = snap.path; //my filesystem class
  7.     t.asc_time = snap.date; //setting time class to the date of the snapshot (unimportant)
  8.     ULL path_count = 0;
  9.     //here is where the problems are:
  10.     snapshot_class snapshot = snap.path; //no problems here
  11.     path_count = snapshot.gsnap().size(); //here is when memory skyrockets
  12.     snapshot.clear(); //after this, there is remaining memory allocated...
  13.    
  14.    
  15.     while(x == 0)
  16.     {
  17.         cls();
  18.         cout<< endl;
  19.         cout<< "                         Snapshot Menu: "<< t.std_time_disp()<< endl;
  20.         cout<< "(Number of paths obtained: "<< path_count<< ")"<< endl;
  21.         cout<< endl<< endl<< endl;
  22.         cout<< " 1 -  Find Changes";
  23.         if(num_of_snaps < 2)
  24.         {
  25.             cout<< "  (Not enough snapshots...)";
  26.         }
  27.         cout<< endl;
  28.        
  29.         cout<< " 2 -  Delete Snapshot"<< endl;
  30.         cout<< " q -  Done"<< endl;
  31.         ch = gkey();
  32.         if(ch == '1')
  33.         {
  34.             compare_snapshot(snap);
  35.             continue;
  36.         }
  37.         if(ch == '2')
  38.         {
  39.             if(is_sure("Do you really want to delete this snapshot?") == true)
  40.             {
  41.                 p.del();
  42.                 return 1;
  43.             }
  44.             continue;
  45.         }
  46.         ch = tolower(ch);
  47.         if(ch == 'q')
  48.         {
  49.             return 0;
  50.         }
  51.     }
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement