Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Model default constructor does not initialize base Model structure members

Open
#351 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
game-dev

Research direction

Start at the raylib::Model default constructor shown in the issue and inspect how it derives from ::Model. Reproduce the provided local-scope example under Visual Studio, then verify that destroying a default-constructed model no longer attempts to free invalid pointers.

Written by the indexing model from the issue text.

Description

I've found that raylib::Model class is deraived from ::Model structure.
Whe you instantiate raylib::Model with default constructor no any members of ::Model is initialized, under Visual Studio you got all of members filled with some debug non zero values.
When you try to call ~Model destructor you will try to free memory by invalid pointer.

This Code inserted anywhere in main will cause an error:

{
    raylib::Model model;
    // You'll get an exception on block exit
}

Very quick fix - add base structure initialization like this:

/**
 * Model type
 */
class Model : public ::Model {
public:
    Model() : ::Model{}
    {
        // Nothing.
    }
Dominant language
C++
Stars
960
Forks
120
Avg merge
10m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RobLoach/raylib-cpp

All issues in RobLoach/raylib-cpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.