Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak(s) found for the QDate object created with the fromString(const QString &string, const QString &format, QCalendar cal = QCalendar()) static method. #1749

Open
Vilcrow opened this issue Mar 9, 2023 · 0 comments

Comments

@Vilcrow
Copy link

Vilcrow commented Mar 9, 2023

OS: Ubuntu 22.04.01.
CppUTest: system installed version.
Qt: qtbase5.

For this case, everything is fine:

TEST_GROUP(DateGroup)
{
    QDate *date;

    void setup()
    {
        date = new QDate(2020, 10, 10);
    }

    void teardown()
    {
        delete date;
    }
};

TEST(DateGroup, Foo)
{
    CHECK(date->isValid());
}

but if we create the date with the fromString(const QString &string, const QString &format, QCalendar cal = QCalendar()) static method:

TEST_GROUP(DateGroup)
{
    QDate *date;

    void setup()
    {
        date = new QDate(QDate::fromString("10-10-2020", "dd-MM-yyyy"));
    }

    void teardown()
    {
        delete date;
    }
};

TEST(DateGroup, Foo)
{
    CHECK(date->isValid());
}

we will get the following:

error: Failure in TEST(DateGroup, Foo)
	Memory leak(s) found.
Alloc num (16) Leak size: 24 Allocated at: <unknown> and line: 0. Type: "new"
	Memory: <0x55deb98db420> Content:
    0000: d4 f7 dc 01 b5 7f 00 00  01 00 00 00 4d 00 00 00 |............M...|
    0010: 00 00 00 00 cd cd cd cd                          |........|
Alloc num (5) Leak size: 96 Allocated at: <unknown> and line: 0. Type: "new"
	Memory: <0x55deb98daec0> Content:
    0000: 70 af 8d b9 de 55 00 00  00 00 00 00 00 00 00 00 |p....U..........|
    0010: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
    0020: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
    0030: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
    0040: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
    0050: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
Alloc num (18) Leak size: 8 Allocated at: <unknown> and line: 0. Type: "new"
	Memory: <0x55deb98db5a0> Content:
    0000: a0 88 f5 01 b5 7f 00 00                          |........|
Alloc num (20) Leak size: 24 Allocated at: <unknown> and line: 0. Type: "new"
	Memory: <0x55deb98db680> Content:
    0000: c0 bd f5 01 b5 7f 00 00  01 00 00 00 00 00 00 00 |................|
    0010: 00 00 00 00 cd cd cd cd                          |........|
Alloc num (15) Leak size: 24 Allocated at: <unknown> and line: 0. Type: "new"
	Memory: <0x55deb98db3b0> Content:
    0000: d4 f7 dc 01 b5 7f 00 00  01 00 00 00 4d 00 00 00 |............M...|
    0010: 00 00 00 00 cd cd cd cd                          |........|
Alloc num (8) Leak size: 136 Allocated at: <unknown> and line: 0. Type: "new []"
	Memory: <0x55deb98db090> Content:
    0000: d0 af 8d b9 de 55 00 00  d0 af 8d b9 de 55 00 00 |.....U.......U..|
    0010: d0 af 8d b9 de 55 00 00  d0 af 8d b9 de 55 00 00 |.....U.......U..|
    0020: d0 af 8d b9 de 55 00 00  d0 af 8d b9 de 55 00 00 |.....U.......U..|
    0030: d0 af 8d b9 de 55 00 00  d0 af 8d b9 de 55 00 00 |.....U.......U..|
    0040: a0 b1 8d b9 de 55 00 00  d0 af 8d b9 de 55 00 00 |.....U.......U..|
    0050: d0 af 8d b9 de 55 00 00  70 b1 8d b9 de 55 00 00 |.....U..p....U..|
    0060: d0 af 8d b9 de 55 00 00  d0 af 8d b9 de 55 00 00 |.....U.......U..|
    0070: d0 af 8d b9 de 55 00 00  d0 af 8d b9 de 55 00 00 |.....U.......U..|
    0080: d0 af 8d b9 de 55 00 00                          |.....U..|
Alloc num (17) Leak size: 32 Allocated at: <unknown> and line: 0. Type: "new"
	Memory: <0x55deb98db490> Content:
    0000: 01 98 eb 5d 05 00 00 00  00 00 00 00 00 00 00 00 |...]............|
    0010: 00 00 00 00 cd cd cd cd  00 00 00 00 00 00 00 00 |................|
Alloc num (6) Leak size: 8 Allocated at: <unknown> and line: 0. Type: "new"
	Memory: <0x55deb98daf70> Content:
    0000: 38 37 f5 01 b5 7f 00 00                          |87......|
Alloc num (13) Leak size: 24 Allocated at: <unknown> and line: 0. Type: "new"
	Memory: <0x55deb98db530> Content:
    0000: d4 f7 dc 01 b5 7f 00 00  01 00 00 00 4d 00 00 00 |............M...|
    0010: 00 00 00 00 00 00 00 00                          |........|
Alloc num (21) Leak size: 24 Allocated at: <unknown> and line: 0. Type: "new"
	Memory: <0x55deb98db6f0> Content:
    0000: c0 bd f5 01 b5 7f 00 00  01 00 00 00 00 00 00 00 |................|
    0010: 00 00 00 00 76 00 61 00                          |....v.a.|
Alloc num (7) Leak size: 48 Allocated at: <unknown> and line: 0. Type: "new"
	Memory: <0x55deb98dafd0> Content:
    0000: 00 00 00 00 00 00 00 00  90 b0 8d b9 de 55 00 00 |.............U..|
    0010: 01 00 00 00 02 00 00 00  20 00 00 00 04 00 04 00 |........ .......|
    0020: 11 00 00 00 6f d2 70 2e  01 00 00 00 00 00 00 00 |....o.p.........|
Alloc num (14) Leak size:
etc etc etc etc. !!!! Too many memory leaks to report. Bailing out
Total number of leaks:  12


.
Errors (1 failures, 1 tests, 1 ran, 1 checks, 0 ignored, 0 filtered out, 1 ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant