r14397: Fix deadcode in coverity error #1.
authorJeremy Allison <jra@samba.org>
Tue, 14 Mar 2006 20:37:24 +0000 (20:37 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:28 +0000 (11:15 -0500)
Jeremy.
(This used to be commit 4a4953c4d27cd1e925c9afe24fa49b015ce033ec)

source3/lib/debug.c

index f3676070dcb6d8bb2c8e59e3d36540f9100971d5..29d879adbc5038969ac1ab67e65b606e0cc0f8be 100644 (file)
@@ -191,12 +191,14 @@ static char *debug_list_class_names_and_levels(void)
        char *b;
        BOOL err = False;
 
-       if (DEBUGLEVEL_CLASS == &debug_all_class_hack)
+       if (DEBUGLEVEL_CLASS == &debug_all_class_hack) {
                return NULL;
+       }
 
        list = SMB_CALLOC_ARRAY(char *, debug_num_classes + 1);
-       if (!list)
+       if (!list) {
                return NULL;
+       }
 
        /* prepare strings */
        for (i = 0, dim = 0; i < debug_num_classes; i++) {
@@ -227,13 +229,12 @@ static char *debug_list_class_names_and_levels(void)
 
 done:
        /* free strings list */
-       for (i = 0; i < debug_num_classes; i++)
-               if (list[i]) free(list[i]);
-       free(list);
+       for (i = 0; i < debug_num_classes; i++) {
+               SAFE_FREE(list[i]);
+       }
+       SAFE_FREE(list);
 
        if (err) {
-               if (buf)
-                       free(buf);
                return NULL;
        } else {
                return buf;