Skip to content

Conversation

@TheKnarf
Copy link
Contributor

This fixes issue #5728.

The problem was that the deviceName was undefined when I tried to create a virtual midi device. That made getName return nil, which in turn crashed lmms when it tried to strlen(nil).

@LmmsBot
Copy link

LmmsBot commented Oct 23, 2020

🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩

Linux

Windows

macOS

🤖
{"platform_name_to_artifacts": {"Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://10045-15778896-gh.circle-artifacts.com/0/lmms-1.2.3-741%2Bg1322fac-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/10045?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://10047-15778896-gh.circle-artifacts.com/0/lmms-1.2.3-741%2Bg1322fac60-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/10047?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://10046-15778896-gh.circle-artifacts.com/0/lmms-1.2.3-741%2Bg1322fac60-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/10046?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/9lq0tb5b7lt6iab6/artifacts/build/lmms-1.2.2-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/36041367"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/6b1e0exafr60g98i/artifacts/build/lmms-1.2.2-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/36041367"}], "macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://10049-15778896-gh.circle-artifacts.com/0/lmms-1.2.3-741%2Bg1322fac60-mac10.13.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/10049?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}]}, "commit_sha": "6fbb0b88026be3cbc4e5ff863aa77c9cf51150c1"}

@TheKnarf
Copy link
Contributor Author

Seems that circleci failed on the macos build because there's something wrong with the homebrew install? That's not really related to my PR at all. Maybe a maintainer can try triggering a rerun of the build?

@DomClark DomClark linked an issue Oct 24, 2020 that may be closed by this pull request
@TheKnarf TheKnarf force-pushed the issue/5728 branch 2 times, most recently from 80668d0 to f06f46f Compare October 29, 2020 21:24
@TheKnarf TheKnarf force-pushed the issue/5728 branch 2 times, most recently from c39fc54 to 84c0292 Compare October 29, 2020 21:52
@TheKnarf TheKnarf requested a review from IanCaio October 29, 2020 21:54
Copy link
Contributor

@IanCaio IanCaio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Veratil
Copy link
Contributor

Veratil commented Oct 29, 2020

I think we have a memory leak (not directly related to this PR's changes). In getName we use malloc to allocate space for both deviceName and endPointName, but then combine them into fullname, leaving both allocations behind without freeing.

Can you add after the sprintf and before the return:

	sprintf(fullName, "%s:%s", deviceName,endPointName);
	if (deviceName != nullptr) { free(deviceName); }
	if (endPointName != nullptr) { free(endPointName); }
	return fullName;

@TheKnarf
Copy link
Contributor Author

@Veratil the code seems to leak everyplace getName is used in the file...

@Veratil
Copy link
Contributor

Veratil commented Oct 29, 2020

@Veratil the code seems to leak everyplace getName is used in the file...

Let's fix them all then while you're there! 😁

@TheKnarf
Copy link
Contributor Author

TheKnarf commented Oct 29, 2020

I'm not about to do that in this PR. Perhaps file an issue for later?

@Veratil
Copy link
Contributor

Veratil commented Oct 29, 2020

I'm not about to do that in this PR. Perhaps file an issue for later?

There are only 4 other locations in that file that use getName. Why not?

@TheKnarf
Copy link
Contributor Author

@Veratil It's unrelated to the bug I'm trying to fix. It would probably be better to refactor getName to return a std::string or QString. And I was hoping to go to bed.

@Veratil
Copy link
Contributor

Veratil commented Oct 29, 2020

Fair enough.

@PhysSong PhysSong merged commit ec2e854 into LMMS:master Oct 30, 2020
@TheKnarf TheKnarf deleted the issue/5728 branch October 30, 2020 12:17
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
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

Successfully merging this pull request may close these issues.

Creating a new virtual midi port crashes Lmms

5 participants