aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/examples/fopen.c12
-rw-r--r--docs/examples/getinmemory.c3
-rw-r--r--docs/examples/postinmemory.c3
3 files changed, 5 insertions, 13 deletions
diff --git a/docs/examples/fopen.c b/docs/examples/fopen.c
index 3d2a81773..4089bb433 100644
--- a/docs/examples/fopen.c
+++ b/docs/examples/fopen.c
@@ -210,9 +210,7 @@ static int use_buffer(URL_FILE *file,int want)
/* sort out buffer */
if((file->buffer_pos - want) <=0) {
/* ditch buffer - write will recreate */
- if(file->buffer)
- free(file->buffer);
-
+ free(file->buffer);
file->buffer=NULL;
file->buffer_pos=0;
file->buffer_len=0;
@@ -302,9 +300,7 @@ int url_fclose(URL_FILE *file)
break;
}
- if(file->buffer)
- free(file->buffer);/* free any allocated buffer space */
-
+ free(file->buffer);/* free any allocated buffer space */
free(file);
return ret;
@@ -435,9 +431,7 @@ void url_rewind(URL_FILE *file)
curl_multi_add_handle(multi_handle, file->handle.curl);
/* ditch buffer - write will recreate - resets stream pos*/
- if(file->buffer)
- free(file->buffer);
-
+ free(file->buffer);
file->buffer=NULL;
file->buffer_pos=0;
file->buffer_len=0;
diff --git a/docs/examples/getinmemory.c b/docs/examples/getinmemory.c
index 1608ec551..a1c21404d 100644
--- a/docs/examples/getinmemory.c
+++ b/docs/examples/getinmemory.c
@@ -106,8 +106,7 @@ int main(void)
/* cleanup curl stuff */
curl_easy_cleanup(curl_handle);
- if(chunk.memory)
- free(chunk.memory);
+ free(chunk.memory);
/* we're done with libcurl, so clean it up */
curl_global_cleanup();
diff --git a/docs/examples/postinmemory.c b/docs/examples/postinmemory.c
index cd2bd13fb..3afac4b2f 100644
--- a/docs/examples/postinmemory.c
+++ b/docs/examples/postinmemory.c
@@ -101,8 +101,7 @@ int main(void)
/* always cleanup */
curl_easy_cleanup(curl);
- if(chunk.memory)
- free(chunk.memory);
+ free(chunk.memory);
/* we're done with libcurl, so clean it up */
curl_global_cleanup();