summaryrefslogtreecommitdiffstats
path: root/src/strings.c
diff options
context:
space:
mode:
authorTheron Spiegl <tspiegl@gmail.com>2020-06-12 18:40:17 -0500
committerTheron Spiegl <tspiegl@gmail.com>2020-06-12 18:40:17 -0500
commitc0dfcbfce1cf1c2d9248a31d8173a2499baa82df (patch)
tree9723de58d9576d44a43674bfda6e391f9f80900b /src/strings.c
parent78425842b42da83dd14c0873e75948b52eefe9f1 (diff)
remove unnecessary null checks for free()
Diffstat (limited to 'src/strings.c')
-rw-r--r--src/strings.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/strings.c b/src/strings.c
index baa433f..9df1c49 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -7,7 +7,7 @@
// new String pointers must be zeroed before being handed to this function
void init_string(struct String *str, size_t initial_capacity)
{
- if (str->data) free(str->data);
+ free(str->data);
str->data = malloc(initial_capacity);
if (str->data == NULL) {
perror("malloc() failed");