Move an assert() to avoid core dumps when a static buffer hasn't been given.
[openssl.git] / crypto / bio / b_print.c
index b7e268f092011b94bc2697ebc3ef9403c4401899..92f9f8f4e69995aa9facd17addfdd83edab1c1b5 100644 (file)
@@ -716,12 +716,13 @@ doapr_outch(
     if (buffer) {
        while (*currlen >= *maxlen) {
            if (*buffer == NULL) {
-               assert(*sbuffer != NULL);
                if (*maxlen == 0)
                    *maxlen = 1024;
                *buffer = OPENSSL_malloc(*maxlen);
-               if (*currlen > 0)
+               if (*currlen > 0) {
+                   assert(*sbuffer != NULL);
                    memcpy(*buffer, *sbuffer, *currlen);
+               }
                *sbuffer = NULL;
            } else {
                *maxlen += 1024;