Skip to content

WebServer: Fix memory leak - #203

Merged
gonosztopi merged 1 commit into
amule-project:masterfrom
sc0w:PR_WebServer_leak
Aug 12, 2020
Merged

WebServer: Fix memory leak#203
gonosztopi merged 1 commit into
amule-project:masterfrom
sc0w:PR_WebServer_leak

Conversation

@sc0w

@sc0w sc0w commented Aug 6, 2020

Copy link
Copy Markdown
Member

No description provided.

Comment thread src/webserver/src/WebServer.cpp Outdated

@gonosztopi gonosztopi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd better check for ip being non-zero early to avoid allocating/deallocating memory unnecessary. Something like if (!ip) return; as the first line of the function, and then the check for ip is not necessary later.

@sc0w
sc0w force-pushed the PR_WebServer_leak branch from a8f9d2c to 47e1b39 Compare August 8, 2020 17:58
@sc0w

sc0w commented Aug 8, 2020

Copy link
Copy Markdown
Member Author

@gonosztopi ok, done

@gonosztopi
gonosztopi merged commit 004879a into amule-project:master Aug 12, 2020
@sc0w
sc0w deleted the PR_WebServer_leak branch August 12, 2020 20:27
ngosang pushed a commit to ngosang/amule that referenced this pull request Jun 20, 2026
…ing under C locale (amule-project#203)

Three binaries that previously did no locale init at all stayed on the
default "C" locale for their whole lifetime, which made wxConvLibc
(and unicode2char() in StringFunctions.cpp) collapse every non-ASCII
codepoint into '?' or escape it. The classic symptom is a filename
like "La.mujer.danesa.1x02.Un.niño.destrozado" surfacing as
"La.mujer.danesa.1x02.Un.ni\361o" in amuled output, amulecmd, the web
UI, etc. Common deployment trigger: Docker / systemd / cron with
LANG/LC_ALL unset.

Three call-sites:
  * src/amuled.cpp -- aMuleInitLocale() at the top of
    CamuleDaemonApp::Initialize(), right after wxAppConsole::Initialize
    returns and before any wxString -> char* conversion fires.
  * src/utils/fileview/FileView.cpp -- aMuleInitLocale() at the top
    of OnInitCmdLine() (CFileView has no OnInit override, so this is
    the earliest hook wxApp calls).
  * src/utils/cas/cas.c -- inline setlocale(LC_ALL, "") + LC_NUMERIC=C
    at the top of main(). cas is plain C, so calling the C++ helper
    would require linkage shimming for no real win; the inline pair
    matches the helper's policy verbatim.

amule, amule-remote-gui, alc, alcc, and wxcas already drive locale
through wxLocale (m_locale.Init() / InitLocale()), so they're left
alone -- the wxLocale codepath calls setlocale internally and was
never broken in the C-locale sense.

amulecmd and amuleweb get migrated to the new helper in a follow-up
commit so this commit's diff is just "add calls, no replace".

Closes amule-org#203.
ngosang pushed a commit to ngosang/amule that referenced this pull request Jun 20, 2026
i18n: fix non-ASCII mangling under default C locale (amule-project#203)
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.

3 participants