Merge branch 'master' of ssh://git.lttng.org/home/git/lttng-tools
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 26 Aug 2011 17:52:32 +0000 (13:52 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 26 Aug 2011 17:52:32 +0000 (13:52 -0400)
1  2 
liblttngctl/lttngctl.c

diff --combined liblttngctl/lttngctl.c
index c2b1242d8c4897c6df6c912e2f6131f36ad6a895,b64ace2e6d80de0ce085791f698604e53f8eb523..4b803dc5b06e4ee76a56caf388d6af3b7911cd18
   */
  
  #define _GNU_SOURCE
- #include <errno.h>
  #include <grp.h>
+ #include <errno.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
  
- #include <lttng/lttng.h>
  #include <lttng-sessiond-comm.h>
- #include "lttngerr.h"
- #include "lttng-share.h"
+ #include <lttng-share.h>
+ #include <lttng/lttng.h>
+ #include <lttngerr.h>
  
  /* Socket to session daemon for communication */
  static int sessiond_socket;
@@@ -153,10 -152,6 +152,10 @@@ static int check_tracing_group(const ch
  
        /* Alloc group list of the right size */
        grp_list = malloc(grp_list_size * sizeof(gid_t));
 +      if (!grp_list) {
 +              ret = -1;
 +              goto end;
 +      }
        grp_id = getgroups(grp_list_size, grp_list);
        if (grp_id < -1) {
                perror("getgroups");
@@@ -348,6 -343,16 +347,16 @@@ static int ask_sessiond(struct lttcomm_
                goto end;
        }
  
+       /*
+        * Extra protection not to dereference a NULL pointer. If buf is NULL at
+        * this point, an error is returned and data is freed.
+        */
+       if (buf == NULL) {
+               ret = -1;
+               free(data);
+               goto end;
+       }
        *buf = data;
        ret = size;
  
This page took 0.025957 seconds and 4 git commands to generate.