Przeglądaj źródła

Fixed some memory leaks.

Dalton Nell 9 lat temu
rodzic
commit
8ed905d243
5 zmienionych plików z 7 dodań i 2 usunięć
  1. 1
    1
      cmdline.h
  2. 1
    0
      main.cpp
  3. 1
    1
      options.ggo
  4. 3
    0
      x.cpp
  5. 1
    0
      x.hpp

+ 1
- 1
cmdline.h Wyświetl plik

@@ -31,7 +31,7 @@ extern "C" {
31 31
 
32 32
 #ifndef CMDLINE_PARSER_VERSION
33 33
 /** @brief the program version */
34
-#define CMDLINE_PARSER_VERSION "v3.1.3"
34
+#define CMDLINE_PARSER_VERSION "v3.1.4"
35 35
 #endif
36 36
 
37 37
 /** @brief Where the command line options are stored */

+ 1
- 0
main.cpp Wyświetl plik

@@ -131,6 +131,7 @@ int main( int argc, char** argv ) {
131 131
     int hmem = 0;
132 132
     int minimumsize = options.min_arg;
133 133
     int maximumsize = options.max_arg;
134
+    cmdline_parser_free( &options );
134 135
 
135 136
     // First we set up the x interface and grab the mouse,
136 137
     // if we fail for either we exit immediately.

+ 1
- 1
options.ggo Wyświetl plik

@@ -1,5 +1,5 @@
1 1
 package "slop"
2
-version "v3.1.3"
2
+version "v3.1.4"
3 3
 usage "slop [options]"
4 4
 description "slop (Select Operation) is an application that queries for a selection from the user and prints the region to stdout."
5 5
 versiontext "Copyright (C) 2014 Dalton Nell, GPLv3"

+ 3
- 0
x.cpp Wyświetl plik

@@ -131,6 +131,7 @@ void slop::XEngine::selectAllInputs( Window win, long event_mask) {
131 131
         XSelectInput( m_display, children[ i ], event_mask );
132 132
         selectAllInputs( children[ i ], event_mask );
133 133
     }
134
+    free( children );
134 135
 }
135 136
 
136 137
 // Grabs the cursor, be wary that setCursor changes the mouse masks.
@@ -308,12 +309,14 @@ void slop::WindowRectangle::setGeometry( Window win, bool decorations ) {
308 309
         // Try to find the actual decorations.
309 310
         test = win;
310 311
         int status = XQueryTree( xengine->m_display, test, &root, &parent, &childlist, &ujunk);
312
+        free( childlist );
311 313
         while( parent != root ) {
312 314
             if ( !parent || !status ) {
313 315
                 break;
314 316
             }
315 317
             test = parent;
316 318
             status = XQueryTree( xengine->m_display, test, &root, &parent, &childlist, &ujunk);
319
+            free( childlist );
317 320
         }
318 321
         // Once found, proceed normally.
319 322
         if ( test && parent == root && status ) {

+ 1
- 0
x.hpp Wyświetl plik

@@ -9,6 +9,7 @@
9 9
 #include <X11/cursorfont.h>
10 10
 #include <X11/extensions/shape.h>
11 11
 
12
+#include <stdlib.h>
12 13
 #include <cstring>
13 14
 #include <cstdlib>
14 15
 #include <cmath>