Fix: use zmalloc in lttng enable_events.c
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Nov 2014 17:29:43 +0000 (12:29 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 26 Nov 2014 20:50:28 +0000 (15:50 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/enable_events.c

index 5ef349097c5622d6e8abc85521e4ae59e937bf95..0b3443caa0d983a96f0f5276aa67aa5b25aef657 100644 (file)
@@ -562,7 +562,10 @@ char *print_exclusions(int count, char **names)
 
        /* add length of preamble + one for NUL - one for last (missing) comma */
        length += strlen(preamble);
 
        /* add length of preamble + one for NUL - one for last (missing) comma */
        length += strlen(preamble);
-       ret = malloc(length);
+       ret = zmalloc(length);
+       if (!ret) {
+               return NULL;
+       }
        strncpy(ret, preamble, length);
        for (i = 0; i < count; i++) {
                strcat(ret, names[i]);
        strncpy(ret, preamble, length);
        for (i = 0; i < count; i++) {
                strcat(ret, names[i]);
This page took 0.025372 seconds and 4 git commands to generate.