diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-01-16 09:35:35 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-01-16 09:35:45 +0100 |
commit | 31dcac7e27e676a3bd00b8359806cb598d10696a (patch) | |
tree | 4acf4ba1ea34ffe596270bf50ca34bb32d832118 /src/util/bio.c | |
parent | 6ebbb6fecbda09436265df7525367cba943b0c07 (diff) | |
download | gnunet-31dcac7e27e676a3bd00b8359806cb598d10696a.tar.gz gnunet-31dcac7e27e676a3bd00b8359806cb598d10696a.zip |
bio: fix memory leak (#7590)
Diffstat (limited to 'src/util/bio.c')
-rw-r--r-- | src/util/bio.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/util/bio.c b/src/util/bio.c index 70620aea7..71d0ef7fc 100644 --- a/src/util/bio.c +++ b/src/util/bio.c | |||
@@ -182,8 +182,9 @@ GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg) | |||
182 | return err; | 182 | return err; |
183 | } | 183 | } |
184 | 184 | ||
185 | |||
185 | void | 186 | void |
186 | GNUNET_BIO_read_set_error (struct GNUNET_BIO_ReadHandle *h, const char* emsg) | 187 | GNUNET_BIO_read_set_error (struct GNUNET_BIO_ReadHandle *h, const char*emsg) |
187 | { | 188 | { |
188 | GNUNET_assert (NULL == h->emsg); | 189 | GNUNET_assert (NULL == h->emsg); |
189 | h->emsg = GNUNET_strdup (emsg); | 190 | h->emsg = GNUNET_strdup (emsg); |
@@ -380,7 +381,6 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | |||
380 | } | 381 | } |
381 | 382 | ||
382 | 383 | ||
383 | |||
384 | /** | 384 | /** |
385 | * Read a float. | 385 | * Read a float. |
386 | * | 386 | * |
@@ -553,8 +553,9 @@ GNUNET_BIO_write_open_buffer (void) | |||
553 | * if the handle has an error message, the return value is #GNUNET_SYSERR | 553 | * if the handle has an error message, the return value is #GNUNET_SYSERR |
554 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise | 554 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise |
555 | */ | 555 | */ |
556 | int | 556 | enum GNUNET_GenericReturnValue |
557 | GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h, char **emsg) | 557 | GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h, |
558 | char **emsg) | ||
558 | { | 559 | { |
559 | int err; | 560 | int err; |
560 | 561 | ||
@@ -567,7 +568,10 @@ GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h, char **emsg) | |||
567 | { | 568 | { |
568 | case IO_FILE: | 569 | case IO_FILE: |
569 | if (NULL == h->fd) | 570 | if (NULL == h->fd) |
570 | return GNUNET_SYSERR; | 571 | { |
572 | err = GNUNET_SYSERR; | ||
573 | break; | ||
574 | } | ||
571 | if (GNUNET_OK != GNUNET_BIO_flush (h)) | 575 | if (GNUNET_OK != GNUNET_BIO_flush (h)) |
572 | { | 576 | { |
573 | if (NULL != emsg) | 577 | if (NULL != emsg) |
@@ -600,7 +604,7 @@ GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h, char **emsg) | |||
600 | * @return #GNUNET_OK upon success. Upon failure #GNUNET_SYSERR is returned | 604 | * @return #GNUNET_OK upon success. Upon failure #GNUNET_SYSERR is returned |
601 | * and the file is closed | 605 | * and the file is closed |
602 | */ | 606 | */ |
603 | int | 607 | enum GNUNET_GenericReturnValue |
604 | GNUNET_BIO_flush (struct GNUNET_BIO_WriteHandle *h) | 608 | GNUNET_BIO_flush (struct GNUNET_BIO_WriteHandle *h) |
605 | { | 609 | { |
606 | ssize_t ret; | 610 | ssize_t ret; |
@@ -793,7 +797,6 @@ GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, | |||
793 | } | 797 | } |
794 | 798 | ||
795 | 799 | ||
796 | |||
797 | /** | 800 | /** |
798 | * Write a float. | 801 | * Write a float. |
799 | * | 802 | * |