DYNBUF.md: note Curl_dyn_add* calls Curl_dyn_free on failure
This is the existing behavior and it has been widely assumed in the codebase. Closes https://github.com/curl/curl/pull/10645
This commit is contained in:
parent
d9ccc75b00
commit
d36c632c86
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user