Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DYNBUF.md: note Curl_dyn_add* calls Curl_dyn_free on failure #10645

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/DYNBUF.md
Expand Up @@ -37,6 +37,8 @@ CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len);

Append arbitrary data of a given length to the end of the buffer.

If this function fails it calls `Curl_dyn_free` on `dynbuf`.

## `Curl_dyn_add`

```c
Expand All @@ -45,6 +47,8 @@ CURLcode Curl_dyn_add(struct dynbuf *s, const char *str);

Append a C string to the end of the buffer.

If this function fails it calls `Curl_dyn_free` on `dynbuf`.

## `Curl_dyn_addf`

```c
Expand All @@ -53,6 +57,8 @@ CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...);

Append a `printf()`-style string to the end of the buffer.

If this function fails it calls `Curl_dyn_free` on `dynbuf`.

## `Curl_dyn_vaddf`

```c
Expand All @@ -61,6 +67,8 @@ CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap);

Append a `vprintf()`-style string to the end of the buffer.

If this function fails it calls `Curl_dyn_free` on `dynbuf`.

## `Curl_dyn_reset`

```c
Expand Down
3 changes: 1 addition & 2 deletions lib/dynbuf.c
Expand Up @@ -99,8 +99,7 @@ static CURLcode dyn_nappend(struct dynbuf *s,
include that as well when it uses this code */
void *p = realloc(s->bufr, a);
if(!p) {
Curl_safefree(s->bufr);
s->leng = s->allc = 0;
Curl_dyn_free(s);
return CURLE_OUT_OF_MEMORY;
}
s->bufr = p;
Expand Down