diff options
author | Bodo Möller <bodo@openssl.org> | 2002-06-06 10:33:05 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-06-06 10:33:05 +0000 |
commit | c6c0e4cb3295b9964a4b2a5a5048d46eed765dce (patch) | |
tree | 7e7197a6a5f8d6332e646ecfa19e8186e1c4a4ae /crypto/ec/ec_print.c | |
parent | 8f6f3478485ac3c091912846755232844ed2a313 (diff) |
fix memory leak
Submitted by: Nils Larsch
Diffstat (limited to 'crypto/ec/ec_print.c')
-rw-r--r-- | crypto/ec/ec_print.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/ec/ec_print.c b/crypto/ec/ec_print.c index 4b9b882668..f7c8a303ac 100644 --- a/crypto/ec/ec_print.c +++ b/crypto/ec/ec_print.c @@ -139,7 +139,7 @@ char *EC_POINT_point2hex(const EC_GROUP *group, { char *ret, *p; size_t buf_len=0,i; - unsigned char *buf; + unsigned char *buf, *pbuf; buf_len = EC_POINT_point2oct(group, point, form, NULL, 0, ctx); @@ -162,14 +162,17 @@ char *EC_POINT_point2hex(const EC_GROUP *group, return NULL; } p = ret; + pbuf = buf; for (i=buf_len; i > 0; i--) { - int v = (int) *(buf++); + int v = (int) *(pbuf++); *(p++)=HEX_DIGITS[v>>4]; *(p++)=HEX_DIGITS[v&0x0F]; } *p='\0'; + OPENSSL_free(buf); + return ret; } |