Skip to content

Resolve memory leaks and a build error#1

Open
mlq wants to merge 2 commits into
haiwen:masterfrom
mlq:master
Open

Resolve memory leaks and a build error#1
mlq wants to merge 2 commits into
haiwen:masterfrom
mlq:master

Conversation

@mlq

@mlq mlq commented Jul 23, 2013

Copy link
Copy Markdown

This patches resolves two memory leaks that occur when a call in _evhtp_request_parser_header_key fails as well as when the function returns. The second patch resolves a build error caused by the missing declaration of SIGTERM. For a more detailed description please refer to the single commit messages.

mlq added 2 commits July 23, 2013 21:42
This patch resolves memory leaks of the variable key_s in
_evhtp_request_parser_header_key by adding proper calls to free the previously
allocated memory upon failure and return. In addition it checks if the initial
allocation of the memory succeeded and acts accordingly.
@jirutka

jirutka commented Apr 8, 2015

Copy link
Copy Markdown

The first patch (Include signal.h for SIGTERM declaration) works and it’s necessary; compilation fails on ‘SIGTERM’ undeclared without it.

The second patch (Resolve memory leaks in evhtp.c) causes error in seaf-server:

*** Error in `seaf-server': double free or corruption (fasttop): 0x00000347480029c0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7e826)[0x34757e45826]
/lib64/libc.so.6(+0x7f5d3)[0x34757e465d3]
/usr/lib64/libevhtp.so(evhtp_kv_free+0x5f)[0x34759f89eff]
/usr/lib64/libevhtp.so(evhtp_kvs_free+0x3c)[0x34759f89ffc]
/usr/lib64/libevhtp.so(+0xf171)[0x34759f8a171]
/usr/lib64/libevhtp.so(evhtp_connection_free+0x2a)[0x34759f8d4ca]
/usr/lib64/libevent-2.1.so.5(+0x1db31)[0x34759453b31]
/usr/lib64/libevent-2.1.so.5(+0x21f4d)[0x34759457f4d]
/usr/lib64/libevent-2.1.so.5(event_base_loop+0x3bf)[0x3475945935f]
/usr/lib64/libevhtp.so(+0x167f4)[0x34759f917f4]
/lib64/libpthread.so.0(+0x8f6a)[0x3475817ff6a]
/lib64/libc.so.6(clone+0x6d)[0x34757eb4e8d]

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.

2 participants