Make sure we don't return 0 on error.
authorRichard Levitte <levitte@openssl.org>
Sun, 24 Jun 2001 07:00:41 +0000 (07:00 +0000)
committerRichard Levitte <levitte@openssl.org>
Sun, 24 Jun 2001 07:00:41 +0000 (07:00 +0000)
crypto/ui/ui_lib.c

index 2559ea54b69e48d3d1c337875234dfddb85eb07f..932658e2b711ffc4297ab7f296550ec3662d93b0 100644 (file)
@@ -176,6 +176,8 @@ static int general_allocate_string(UI *ui, const char *prompt,
                        s->_.string_data.result_maxsize=maxsize;
                        s->_.string_data.test_buf=test_buf;
                        ret=sk_UI_STRING_push(ui->strings, s);
+                       /* sk_push() returns 0 on error.  Let's addapt that */
+                       if (ret <= 0) ret--;
                        }
                else
                        free_string(s);
@@ -223,6 +225,9 @@ static int general_allocate_boolean(UI *ui,
                                s->_.boolean_data.ok_chars = ok_chars;
                                s->_.boolean_data.cancel_chars = cancel_chars;
                                ret=sk_UI_STRING_push(ui->strings, s);
+                               /* sk_push() returns 0 on error.
+                                  Let's addapt that */
+                               if (ret <= 0) ret--;
                                }
                        else
                                free_string(s);