Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Langley <agl@google.com>2014-10-02 02:21:01 +0400
committerAdam Langley <agl@google.com>2014-10-07 05:38:05 +0400
commit5f1374e203b79f38349fe0568a31bd95e079f878 (patch)
treeeac52f110ab1dc344a3fab7237fbe32b5bcb7e7d /crypto/err/err_test.c
parent622a6db14eb4f5147b32c13353289c288f6c3818 (diff)
Retain ownership of malloced error data.
I misunderstood the OpenSSL semantics here. When receiving an error data pointer via ERR_get_error_line_data and friends, although the error is cleared, OpenSSL retains ownership of the data pointer. It's kept in the cleared error until another error overrides it, or the whole error queue is cleared. It's pretty odd to have live pointers in empty errors so this change allows an error queue to retain one data pointer. Thus the pointer returned from ERR_get_error_line_data is valid until the next call to ERR_get_error_line_data, or until the queue is freed. From reviewing uses of the API, this is sufficient for all of them. Change-Id: I73cb8e9c792452ae3c1a934ac8bbe8b5353b65b2 Reviewed-on: https://boringssl-review.googlesource.com/1880 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/err/err_test.c')
-rw-r--r--crypto/err/err_test.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/crypto/err/err_test.c b/crypto/err/err_test.c
index 230cadae..cb100fe5 100644
--- a/crypto/err/err_test.c
+++ b/crypto/err/err_test.c
@@ -44,8 +44,7 @@ static int test_overflow(void) {
static int test_put_error(void) {
uint32_t packed_error;
int line, flags;
- const char *file;
- char *data;
+ const char *file, *data;
if (ERR_get_error() != 0) {
fprintf(stderr, "ERR_get_error returned value before an error was added.\n");
@@ -68,8 +67,6 @@ static int test_put_error(void) {
return 0;
}
- OPENSSL_free(data);
-
return 1;
}