]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Reduce scope of custom in fr_vasprintf
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 19 Nov 2016 14:21:51 +0000 (09:21 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 19 Nov 2016 14:22:12 +0000 (09:22 -0500)
src/lib/print.c

index bf6069bd37977b42e9d373c7f70e7711b6cb22c0..676e3f489aef661d95e79fedbd8c64ffafea2120 100644 (file)
@@ -434,7 +434,6 @@ char *fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap)
        do {
 
                char            *q;
-               char            *custom = NULL;
                char            len[2] = { '\0', '\0' };
                long            precision = 0, tmp;
 
@@ -599,11 +598,13 @@ char *fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap)
                        break;
 
                case 'p':
+               {
+                       char *custom = NULL;
+
                        /*
                         *      Custom types
                         */
                        switch (*(p + 1)) {
-
                        case 'H':
                        {
                                value_box_t const *value = va_arg(ap_q, value_box_t const *);
@@ -635,7 +636,7 @@ char *fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap)
                                        oom:
                                                fr_strerror_printf("Out of memory");
                                                talloc_free(out);
-                                               if (custom) talloc_free(custom);
+                                               talloc_free(custom);
                                                va_end(ap_p);
                                                va_end(ap_q);
                                                return NULL;
@@ -681,6 +682,7 @@ char *fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap)
                                (void) va_arg(ap_q, void *);                                    /* void * */
                        }
                        break;
+               }
 
                case 'n':
                        (void) va_arg(ap_q, int *);                                     /* int * */