Skip to content

Commit 84d1ede

Browse files
committed
Fix if statement based off of uninitialized memory in part3
1 parent 02a1a79 commit 84d1ede

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

_parts/part3.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Lastly, we need to initialize the table and handle a few more error cases:
185185

186186
```diff
187187
+ Table* new_table() {
188-
+ Table* table = malloc(sizeof(Table));
188+
+ Table* table = calloc(sizeof(Table));
189189
+ table->num_rows = 0;
190190
+
191191
+ return table;
@@ -334,7 +334,7 @@ We'll address those issues in the next part. For now, here's the complete diff f
334334
+}
335335
+
336336
+Table* new_table() {
337-
+ Table* table = malloc(sizeof(Table));
337+
+ Table* table = calloc(sizeof(Table));
338338
+ table->num_rows = 0;
339339
+
340340
+ return table;
@@ -426,4 +426,4 @@ We'll address those issues in the next part. For now, here's the complete diff f
426426
+ }
427427
}
428428
}
429-
```
429+
```

0 commit comments

Comments
 (0)