Browse Source

Fixed some memory leaks.

Dalton Nell 10 years ago
parent
commit
8ed905d243
5 changed files with 7 additions and 2 deletions
  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 View File

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

+ 1
- 0
main.cpp View File

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

+ 1
- 1
options.ggo View File

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

+ 3
- 0
x.cpp View File

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

+ 1
- 0
x.hpp View File

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