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

Add additional check returned from flb_malloc #3045

Merged
merged 1 commit into from Feb 9, 2021

Conversation

yongtang
Copy link
Contributor

@yongtang yongtang commented Feb 9, 2021

This PR tries to address the issue raised in #3044 where
memory pointer returned from flb_malloc was not checked for NULL.
Credit to @raminfp.

This PR fixes the #3044.

Signed-off-by: Yong Tang yong.tang.github@outlook.com

Example config:

$ cat fluent-bit.conf 
[INPUT]
    Name  cpu

[OUTPUT]
    Name        kafka
    Match       *
    Brokers     192.168.1.3:9092
    Topics      test

Valgrind:

$ valgrind --leak-check=full  bin/fluent-bit -c fluent-bit.conf 
==493573== Memcheck, a memory error detector
==493573== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==493573== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==493573== Command: bin/fluent-bit -c fluent-bit.conf
==493573== 
Fluent Bit v1.7.0
* Copyright (C) 2019-2020 The Fluent Bit Authors
* Copyright (C) 2015-2018 Treasure Data
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2021/02/09 15:14:50] [ info] [engine] started (pid=493573)
[2021/02/09 15:14:50] [ info] [storage] version=1.1.0, initializing...
[2021/02/09 15:14:50] [ info] [storage] in-memory
[2021/02/09 15:14:50] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2021/02/09 15:14:50] [ info] [output:kafka:kafka.0] brokers='192.168.1.3:9092' topics='test'
[2021/02/09 15:14:50] [ info] [sp] stream processor started
^C[2021/02/09 15:14:53] [engine] caught signal (SIGINT)
[2021/02/09 15:14:53] [ info] [input] pausing cpu.0
[2021/02/09 15:14:53] [ warn] [engine] service will stop in 5 seconds
[2021/02/09 15:14:57] [ info] [engine] service stopped
==493573== 
==493573== HEAP SUMMARY:
==493573==     in use at exit: 0 bytes in 0 blocks
==493573==   total heap usage: 398 allocs, 398 frees, 688,865 bytes allocated
==493573== 
==493573== All heap blocks were freed -- no leaks are possible
==493573== 
==493573== For lists of detected and suppressed errors, rerun with: -s
==493573== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

Documentation

  • [N/A] Documentation required for this feature

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

This PR tries to address the issue raised in 3044 where
memory pointer returned from flb_malloc was not checked for NULL.
Credit to raminfp.

This PR fixes the 3044.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
@edsiper edsiper merged commit 1f0918b into fluent:master Feb 9, 2021
2 checks passed
@edsiper
Copy link
Member

edsiper commented Feb 9, 2021

thanks @yongtang .

About the commit messages, please check this one: https://github.com/fluent/fluent-bit/blob/master/CONTRIBUTING.md#commit-changes

@yongtang yongtang deleted the 3044-flb_avro branch February 9, 2021 19:04
@yongtang
Copy link
Contributor Author

yongtang commented Feb 9, 2021

@edsiper Ah I didn't notice the commit message before. Will take note and apply for future commits.

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.

None yet

2 participants