Skip to content

Commit

Permalink
Fix use of unitialized pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
TanmayPatil105 committed Jun 12, 2024
1 parent b65acb9 commit b851d0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/html.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ static void
html_unit_init (HTMLUnit **unit,
MDUnit *md_unit)
{
*unit = malloc (sizeof (HTMLUnit));
*unit = (HTMLUnit *) malloc (sizeof (HTMLUnit));
memset(*unit, 0, sizeof(HTMLUnit));

// malloc fails
if (*unit == NULL)
Expand Down
3 changes: 2 additions & 1 deletion src/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ md_init (MD **md)
static void
md_unit_init (MDUnit **unit)
{
*unit = malloc (sizeof (MDUnit));
*unit = (MDUnit *) malloc (sizeof (MDUnit));
memset (*unit, 0, sizeof(unit));

// malloc fails
if (*unit == NULL)
Expand Down

0 comments on commit b851d0d

Please sign in to comment.