Skip to content

Commit b970698

Browse files
committed
Task 4 of 0x0E structures and typedef
1 parent 9610b3c commit b970698

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

0x0E-structures_typedef/4-new_dog.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ dog_t *new_dog(char *name, float age, char *owner)
2929
max_dog->name = malloc(sizeof(char) * name_1);
3030

3131
if (max_dog->name == NULL)
32+
{
33+
free(max_dog);
34+
return (NULL);
35+
}
36+
37+
max_dog->owner = malloc(sizeof(char) * own_1);
38+
39+
if (max_dog->owner == NULL)
3240
{
3341
free(max_dog->name);
3442
free(max_dog);
@@ -77,7 +85,7 @@ char *_strcpy(char *dest, char *src)
7785

7886
for (i = 0; src[i] != '\0'; i++)
7987
{
80-
dest[i] = src[i]
88+
dest[i] = src[i];
8189
}
8290

8391
dest[i++] = '\0';

0x0E-structures_typedef/e

16.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)