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

Mixed malloc and g_free may leading to memory corruption #679

Closed
jing3018 opened this issue Nov 9, 2016 · 3 comments
Closed

Mixed malloc and g_free may leading to memory corruption #679

jing3018 opened this issue Nov 9, 2016 · 3 comments

Comments

@jing3018
Copy link
Contributor

jing3018 commented Nov 9, 2016

jansson use malloc ,but we use g_free to release the memory.
new glib use system malloc to alloc memory, so I think we need to update glib to avoid this problem. now I use glib-2.48.2.

@lminiero
Copy link
Member

lminiero commented Nov 9, 2016

We don't use g_free on jansson stuff so I don't see any problem.

Il 09/nov/2016 04:18, "Ging" notifications@github.com ha scritto:

jansson use malloc ,but we use g_free to release the memory.
new glib use system malloc to alloc memory, so I think we need to update
glib to avoid this problem. now I use glib-2.48.2.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#679, or mute the thread
https://github.com/notifications/unsubscribe-auth/ADg5vLJDXLTzsixwsFnkMo2qFyXfAuGLks5q8TtxgaJpZM4KtJnD
.

@jing3018
Copy link
Contributor Author

jing3018 commented Nov 9, 2016

see json_dumps related code
eg
transports/janus_rabbitmq.c:639

char *payload_text = json_dumps(response->payload, json_format);
...
g_free(payload_text);

@lminiero
Copy link
Member

Good point, I hadn't thought about those. I guess they're the only occurrences where that may happen, though. I never experienced issues but it might be because on my Fedora glib has always been new "enough" (I have 2.44 right now). Probably the easiest way to avoid issues no matter the version is to simply use free instead of g_free for all the json_dumps we use.

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

2 participants