New issue
Advanced search Search tips

Issue 844092 link

Starred by 6 users

Issue metadata

Status: Verified
Owner:
Closed: Jul 6
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug
Build-Toolchain



Sign in to add a comment

Memory leaks in adhd

Project Member Reported by manojgupta@chromium.org, May 17 2018

Issue description

While doing a full system fuzzing instrumentation, I ran into memory leaks in adhd.

Attaching the logs, there are like 17 tests that leak  memory.
 
logs.tgz
19.2 KB Download

Comment 1 by dgreid@google.com, May 17 2018

Owner: cychiang@chromium.org
I sent a fix for 2/17 failing tests at https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/1064605

I hope cychiang@ can take care of rest.


Project Member

Comment 3 by bugdroid1@chromium.org, May 19 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/380b741d8513f84362e96b3481e0bb42ae9cb061

commit 380b741d8513f84362e96b3481e0bb42ae9cb061
Author: Manoj Gupta <manojgupta@google.com>
Date: Sat May 19 00:19:56 2018

adhd: Fix some memory leaks.

After a full system ASan instrumentation, many memory leaks were
reported in adhd tests.

Fix the leaks in a2dp_iodev_unittest and hfp_iodev_unittest
(2/17 leaking tests).

BUG= chromium:844092 
TEST=No more leaks in a2dp_iodev_unittest and hfp_iodev_unittest.

Change-Id: I49a5e7110dd2cfc21891c9f088b80535d3b0a881
Reviewed-on: https://chromium-review.googlesource.com/1064605
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/380b741d8513f84362e96b3481e0bb42ae9cb061/cras/src/tests/hfp_iodev_unittest.cc
[modify] https://crrev.com/380b741d8513f84362e96b3481e0bb42ae9cb061/cras/src/tests/a2dp_iodev_unittest.cc

Project Member

Comment 4 by bugdroid1@chromium.org, May 19 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/7858adda1fc233a724d0c1262d7ec2011758d3a4

commit 7858adda1fc233a724d0c1262d7ec2011758d3a4
Author: Manoj Gupta <manojgupta@google.com>
Date: Sat May 19 16:23:18 2018

adhd: Enable asan.

Allow building adhd with address sanitizer. This allows finding
memory leaks and some other issues in adhd.

BUG= chromium:844092 
TEST=adhd builds (unit tests fail with asan enabled).

Change-Id: I55b63bc30f853419f2c643ef91098c7b8ea94128
Reviewed-on: https://chromium-review.googlesource.com/1065494
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/7858adda1fc233a724d0c1262d7ec2011758d3a4/media-sound/adhd/adhd-9999.ebuild

Cc: cychiang@chromium.org
Owner: paulhsia@chromium.org
Status: Assigned (was: Untriaged)
Hi manojgupta, thank you for filing the bug and the fix.
I used valgrind and can find the memory leaks.

Hi Paul, please follow the steps in https://docs.google.com/document/d/1XQAPFqW_4Obj0gC5i_8FJn3mveGQkxc5BCKl9sxdQv8/edit#heading=h.hcssccysn3l2 to repro the leak and fix them.

Thanks!
Project Member

Comment 6 by bugdroid1@chromium.org, May 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/0dfa2f6580a62a964d56e5ebd0e2d720bc5d233b

commit 0dfa2f6580a62a964d56e5ebd0e2d720bc5d233b
Author: paulhsia <paulhsia@chromium.org>
Date: Tue May 22 13:17:09 2018

adhd: Fix accessing uninitialized pointer in alsa_io_unittest

(3/17 leaking tests for the issue)

Initialize and destroy cras_alsa_mmap_begin_buffer AlsaFreeRunTestSuite in SetUp
and TearDown for all tests under it.

BUG= chromium:844092 
TEST=Apply full patch set to run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_io_unittest

Change-Id: I7ed519da485643c2f50b71cbbfbba83c74a55b09
Reviewed-on: https://chromium-review.googlesource.com/1065397
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/0dfa2f6580a62a964d56e5ebd0e2d720bc5d233b/cras/src/tests/alsa_io_unittest.cc

Project Member

Comment 7 by bugdroid1@chromium.org, May 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/9fb11131219644930ae59ff6f1619a14ff29a779

commit 9fb11131219644930ae59ff6f1619a14ff29a779
Author: paulhsia <paulhsia@chromium.org>
Date: Tue May 22 13:17:10 2018

adhd: Fix memory leaks and uninitialized values in alsa_io_unittest

(3/17 leaking tests for the issue)

Fix the memory leaks and using uninitialized values in alsa_io_unittest.

BUG= chromium:844092 
TEST=Apply full patch set to run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_io_unittest

Change-Id: If2757cacc9e07853232567d7584b0c4776c52bb1
Reviewed-on: https://chromium-review.googlesource.com/1065398
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/9fb11131219644930ae59ff6f1619a14ff29a779/cras/src/tests/alsa_io_unittest.cc

Project Member

Comment 8 by bugdroid1@chromium.org, May 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/b17de17308e8bd129d0dbecab71fb14aee405eac

commit b17de17308e8bd129d0dbecab71fb14aee405eac
Author: paulhsia <paulhsia@chromium.org>
Date: Tue May 22 13:17:11 2018

adhd: Remove uninitialized string and syslog call in cras_alsa_jack.c

(4/17 leaking tests for the issue)

char* device_name is uninitialized and it's used by syslog. This will
cause memory access out of bounds if the memory bytes are dirty in the
string.

Remove it since it's only used by syslog.
Remove the syslog call as well.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_jack_unittest

Change-Id: I1b366f6f08a5f0007f31c6bc78576ad20250c416
Reviewed-on: https://chromium-review.googlesource.com/1067518
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/b17de17308e8bd129d0dbecab71fb14aee405eac/cras/src/server/cras_alsa_jack.c

Project Member

Comment 9 by bugdroid1@chromium.org, May 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/4ba6259e9d95654372e6452fa57d63bb22a5ad3b

commit 4ba6259e9d95654372e6452fa57d63bb22a5ad3b
Author: paulhsia <paulhsia@chromium.org>
Date: Tue May 22 13:17:10 2018

adhd: Fix memory leaks in alsa_jack_unittest

(4/17 leaking tests for the issue)

Mixer will be free in alsa_card_destroy now, we should free it explicitly.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_jack_unittest

Change-Id: I0d2aa037b6a071dc0982be7d63bd159e9bf096d8
Reviewed-on: https://chromium-review.googlesource.com/1067557
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/4ba6259e9d95654372e6452fa57d63bb22a5ad3b/cras/src/tests/alsa_jack_unittest.cc

Project Member

Comment 10 by bugdroid1@chromium.org, May 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/3f7cfdd039718cdc3085dfe7b3b73da10bdab19b

commit 3f7cfdd039718cdc3085dfe7b3b73da10bdab19b
Author: paulhsia <paulhsia@chromium.org>
Date: Wed May 23 04:56:41 2018

adhd: Fix memory leaks in cras_hfp_iodev

(7/17 leaking tests for the issue)

supported_formats should be freed and cras_iodev_free_resources should
be called in hfp_free_resources.

BUG= chromium:844092 
TEST=hfp_iodev_unittest

Change-Id: I0fe98e4b08417681f06e68b2a5527fdcf0409f7e
Reviewed-on: https://chromium-review.googlesource.com/1068748
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/3f7cfdd039718cdc3085dfe7b3b73da10bdab19b/cras/src/server/cras_hfp_iodev.c
[modify] https://crrev.com/3f7cfdd039718cdc3085dfe7b3b73da10bdab19b/cras/src/tests/hfp_iodev_unittest.cc

Project Member

Comment 11 by bugdroid1@chromium.org, May 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/45ead62899c61f643010cf70b1822f4cca1e261f

commit 45ead62899c61f643010cf70b1822f4cca1e261f
Author: paulhsia <paulhsia@chromium.org>
Date: Wed May 23 04:56:42 2018

adhd: Fix memory leak and refactor in hfp_iodev_unittest

(7/17 leaking tests for the issue)

Memory leak at variable dummy_audio_area.
Create class HfpIodev with SetUp and TearDown for stub data.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all hfp_iodev_unittest

Change-Id: If7924ee41a5fcedf62ed51adaa3abc3899cd29a1
Reviewed-on: https://chromium-review.googlesource.com/1068749
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/45ead62899c61f643010cf70b1822f4cca1e261f/cras/src/tests/hfp_iodev_unittest.cc

Project Member

Comment 12 by bugdroid1@chromium.org, May 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/6e20c5f5e1413fa4be045163413b9aba04ac909e

commit 6e20c5f5e1413fa4be045163413b9aba04ac909e
Author: paulhsia <paulhsia@chromium.org>
Date: Wed May 23 04:56:40 2018

adhd: Fix memory leaks in cras_bt_io.c

(5/17 leaking tests for the issue)

bt_iodev should free its resources in its destroy function and use
cras_iodev_free_resources to free its base object resources.

Create a cras_bt_io_free_resources function for destroying bt_iodev.
Move loop for removing nodes to the function as well.

BUG= chromium:844092 
TEST=unittest
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all bt_io_unittest

Change-Id: I889cbb9e5e22a34200ba316934aa4619701d709d
Reviewed-on: https://chromium-review.googlesource.com/1068895
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/6e20c5f5e1413fa4be045163413b9aba04ac909e/cras/src/tests/bt_io_unittest.cc
[modify] https://crrev.com/6e20c5f5e1413fa4be045163413b9aba04ac909e/cras/src/server/cras_bt_io.c

Project Member

Comment 13 by bugdroid1@chromium.org, May 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/17080462718fc01f5af06476abe5bc271883fb14

commit 17080462718fc01f5af06476abe5bc271883fb14
Author: paulhsia <paulhsia@chromium.org>
Date: Wed May 23 04:56:41 2018

adhd: Fix memory leaks in bt_io_unittest

(5/17 leaking tests for the issue)

Call destroy function for bt_iodev in the end of all tests.
Free resources of stubs explicitly.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all bt_io_unittest

Change-Id: Ie7c4a25a6ccc70e8dd476d35ab20ac1616497e7b
Reviewed-on: https://chromium-review.googlesource.com/1068896
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/17080462718fc01f5af06476abe5bc271883fb14/cras/src/tests/bt_io_unittest.cc

Project Member

Comment 14 by bugdroid1@chromium.org, May 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/55893b716e3ab35d2d7599eb76049c4ed33fd8a4

commit 55893b716e3ab35d2d7599eb76049c4ed33fd8a4
Author: paulhsia <paulhsia@chromium.org>
Date: Wed May 23 04:56:41 2018

adhd: Fix memory leaks and use after free in bt_device_unittest

(6/17 leaking tests for the issue)

Call destroy function for bt_device.
cras_main_message is a local variable from caller, we should allocate
memory from heap and copy its data.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all bt_device_unittest

Change-Id: I79145766f54da9250a536266da1c6cf2cca6cb1d
Reviewed-on: https://chromium-review.googlesource.com/1068897
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/55893b716e3ab35d2d7599eb76049c4ed33fd8a4/cras/src/tests/bt_device_unittest.cc

Project Member

Comment 15 by bugdroid1@chromium.org, May 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/86d5686f4c919ecca07908a0e34f581df26a1bbc

commit 86d5686f4c919ecca07908a0e34f581df26a1bbc
Author: paulhsia <paulhsia@chromium.org>
Date: Wed May 23 08:25:41 2018

adhd: Fix memory leak in cras_a2dp_iodev.c

(8/17 leaking tests for the issue)

supported_formats should be freed in free_resources in cras_a2dp_iodev.

BUG= chromium:844092 
TEST=No memory leak after calling a2dp_iodev_destroy if
update_supported_formats is called before it

Change-Id: I1693e136c7135f345e43db26dd3979723ebd19f7
Reviewed-on: https://chromium-review.googlesource.com/1068782
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>

[modify] https://crrev.com/86d5686f4c919ecca07908a0e34f581df26a1bbc/cras/src/server/cras_a2dp_iodev.c

Project Member

Comment 16 by bugdroid1@chromium.org, May 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/2b9e900f91be226cd6f94f518e45f1d2fa3c5618

commit 2b9e900f91be226cd6f94f518e45f1d2fa3c5618
Author: paulhsia <paulhsia@chromium.org>
Date: Wed May 23 08:25:41 2018

adhd: Fix memory leaks and refactor in a2dp_iodev_unittest

(8/17 leaking tests for the issue)

Memory leak at variable dummy_audio_area and atlog.
Create class A2dpIodev with SetUp and TearDown for stub data.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all a2dp_iodev_unittest

Change-Id: I2de3c3b919ba689a0423703e63130da74246de46
Reviewed-on: https://chromium-review.googlesource.com/1068783
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>

[modify] https://crrev.com/2b9e900f91be226cd6f94f518e45f1d2fa3c5618/cras/src/tests/a2dp_iodev_unittest.cc

Project Member

Comment 17 by bugdroid1@chromium.org, May 24 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/062f0ffc77c3681d25880d6dbda83ec5f4f96f7a

commit 062f0ffc77c3681d25880d6dbda83ec5f4f96f7a
Author: paulhsia <paulhsia@chromium.org>
Date: Thu May 24 18:59:03 2018

adhd: Fix memory leak in cras_alsa_mixer.c

(9/17 leaking tests for the issue)

Free local variable mixer_name* default_controls by calling
mixer_name_free in cras_alsa_mixer_add_controls_by_name_matching.
When the function exits early by error return code, it should free it,
too.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_mixer_unittest

Change-Id: Ibeb9f1d131baa2a913521cc873fec57d39d82051
Reviewed-on: https://chromium-review.googlesource.com/1068590
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Chih-Yang Hsia <paulhsia@google.com>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>

[modify] https://crrev.com/062f0ffc77c3681d25880d6dbda83ec5f4f96f7a/cras/src/server/cras_alsa_mixer.c

Project Member

Comment 18 by bugdroid1@chromium.org, May 24 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/0fdafac2916565452ef6ee4463c44663b0f526f5

commit 0fdafac2916565452ef6ee4463c44663b0f526f5
Author: paulhsia <paulhsia@chromium.org>
Date: Thu May 24 18:59:03 2018

adhd: Fix memory leak in alsa_mixer_unittest

(9/17 leaking tests for the issue)

Call cras_alsa_mixer_destroy in the end of all tests.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_mixer_unittest

Change-Id: I1294f194ca49a507edcba8f1698a98de9a26f82b
Reviewed-on: https://chromium-review.googlesource.com/1068591
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Chih-Yang Hsia <paulhsia@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/0fdafac2916565452ef6ee4463c44663b0f526f5/cras/src/tests/alsa_mixer_unittest.cc

Project Member

Comment 19 by bugdroid1@chromium.org, May 24 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/8d61072a2c74b73889862b4a6472c4d01e4fd1ad

commit 8d61072a2c74b73889862b4a6472c4d01e4fd1ad
Author: paulhsia <paulhsia@chromium.org>
Date: Thu May 24 18:59:04 2018

adhd: Fix memory leaks in iodev_list_unittest

(10/17 leaking tests for the issue)

Call cras_iodev_list_reset to destroy enabled_devices in TearDown.
Call cras_iodev_list_deinit for each test which uses
cras_iodev_list_init.
Free active_node in empty_iodev_destroy.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all iodev_list_unittest

Change-Id: Ide46b040900db16efccfb89d5b5ebc7f43cb9e93
Reviewed-on: https://chromium-review.googlesource.com/1070827
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Chih-Yang Hsia <paulhsia@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/8d61072a2c74b73889862b4a6472c4d01e4fd1ad/cras/src/tests/iodev_list_unittest.cc

Project Member

Comment 20 by bugdroid1@chromium.org, May 24 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/159d987c00b4def954551d4da54e32960dfb6b55

commit 159d987c00b4def954551d4da54e32960dfb6b55
Author: paulhsia <paulhsia@chromium.org>
Date: Thu May 24 18:59:04 2018

adhd: Fix memory leaks in linear_resampler_unittest

(8/16 leaking tests for the issue, some fixes in the previous commits are
related to the same file, and one of the reported files is empty)

Call linear_resampler_destroy to destroy linear_resampler.
Fix typo in header.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all
linear_resampler_unittest

Change-Id: I052392a8cea1be4de683c3535e9a78b6186fa745
Reviewed-on: https://chromium-review.googlesource.com/1070947
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Chih-Yang Hsia <paulhsia@google.com>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>

[modify] https://crrev.com/159d987c00b4def954551d4da54e32960dfb6b55/cras/src/tests/linear_resampler_unittest.cc

Project Member

Comment 21 by bugdroid1@chromium.org, May 26 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/eae126292a244a4034b092273ddb63edcd1f5dbd

commit eae126292a244a4034b092273ddb63edcd1f5dbd
Author: paulhsia <paulhsia@chromium.org>
Date: Sat May 26 03:31:52 2018

adhd: Fix use after free in alert_unittest

(9/16 leaking tests for the issue)

Data will be freed after calling cras_alert_process_all_pending_alerts.
If we want to access the data, we should copy its value.

CRAS use the function and the data correctly in cras_observer.c.

Use structure instead of string to simulate how the CRAS use cras_alert
functions now.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alert_unittest

Change-Id: I6bafb8fd0aaf1d000f63a729752d66990bd108ea
Reviewed-on: https://chromium-review.googlesource.com/1071130
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/eae126292a244a4034b092273ddb63edcd1f5dbd/cras/src/tests/alert_unittest.cc

Project Member

Comment 22 by bugdroid1@chromium.org, May 26 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/792823a1842c52cbf2b6d0af544658a325b3b542

commit 792823a1842c52cbf2b6d0af544658a325b3b542
Author: paulhsia <paulhsia@chromium.org>
Date: Sat May 26 03:31:53 2018

adhd: Fix memory leaks in dev_stream_unittest

(10/16 leaking tests for the issue)

Call dev_stream_destroy and byte_buffer_destroy for dev_stream and
conv_buffer in tests.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all dev_stream_unittest

Change-Id: I688bb9a69e04884f0e9765ce8d8b9ff8afe964c9
Reviewed-on: https://chromium-review.googlesource.com/1071414
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/792823a1842c52cbf2b6d0af544658a325b3b542/cras/src/tests/dev_stream_unittest.cc

Hi manojgupta@,

I used valgrind to check memory leaks locally.
I'd like to run your checks, could you teach me how to run your reproduce steps?

Thanks!
Paul
Project Member

Comment 24 by bugdroid1@chromium.org, May 29 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/3f78af9950f9df6a2e6bb832b2c5dad60403c56c

commit 3f78af9950f9df6a2e6bb832b2c5dad60403c56c
Author: paulhsia <paulhsia@chromium.org>
Date: Tue May 29 05:46:21 2018

adhd: Fix memory leak in cras_alsa_card

(11/16 leaking tests for the issue)

Free dev get from ucm_get_dev_for_mixer in filter_controls.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_card_unittest

Change-Id: I1d3012107b0c29148268fb076ebc27f9bd5c497b
Reviewed-on: https://chromium-review.googlesource.com/1073130
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/3f78af9950f9df6a2e6bb832b2c5dad60403c56c/cras/src/server/cras_alsa_card.c

Project Member

Comment 25 by bugdroid1@chromium.org, May 29 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/854469d18feb842581565bf8d91b0972c76efb28

commit 854469d18feb842581565bf8d91b0972c76efb28
Author: paulhsia <paulhsia@chromium.org>
Date: Tue May 29 05:46:21 2018

adhd: Fix memory leak in alsa_card_unittest

(11/16 leaking tests for the issue)

Call destroy for cras_alsa_card.
Initialize enum.
Remove unused ucm_section.
Make alsa stub functions snd_pcm_info_get_name and snd_pcm_info_get_id.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_card_unittest

Change-Id: I497db1ae9232d5e357f60973a21a6bef0aee78ec
Reviewed-on: https://chromium-review.googlesource.com/1073131
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/854469d18feb842581565bf8d91b0972c76efb28/cras/src/tests/alsa_card_unittest.cc

Project Member

Comment 26 by bugdroid1@chromium.org, May 29 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/ad1abeee791b61b21fba6a684dd79fa44bd98bb2

commit ad1abeee791b61b21fba6a684dd79fa44bd98bb2
Author: paulhsia <paulhsia@chromium.org>
Date: Tue May 29 05:46:22 2018

adhd: Fix memory leaks in cras_alsa_ucm

(12/16 leaking tests for the issue)

Free several local allocated char* in cras_alsa_ucm functions.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_ucm_unittest

Change-Id: I8e7b6b96da8a9b9e6523a3c1aadc8bb10a10e8e0
Reviewed-on: https://chromium-review.googlesource.com/1073347
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/ad1abeee791b61b21fba6a684dd79fa44bd98bb2/cras/src/server/cras_alsa_ucm.c

Project Member

Comment 27 by bugdroid1@chromium.org, May 29 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/2af96b63796c109183c0f72340ea1ce97c713098

commit 2af96b63796c109183c0f72340ea1ce97c713098
Author: paulhsia <paulhsia@chromium.org>
Date: Tue May 29 05:46:22 2018

adhd: Fix memory leaks in alsa_ucm_unittest

(12/16 leaking tests for the issue)

Free several local allocated char* in tests in alsa_ucm_unittest.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_ucm_unittest

Change-Id: I7d92707cc7fa4f6d43281fc58aec7db1d114935b
Reviewed-on: https://chromium-review.googlesource.com/1073348
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/2af96b63796c109183c0f72340ea1ce97c713098/cras/src/tests/alsa_ucm_unittest.cc

Project Member

Comment 28 by bugdroid1@chromium.org, May 31 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/0e9ac1a513e9f3f1226277ab86d5fb0900344d98

commit 0e9ac1a513e9f3f1226277ab86d5fb0900344d98
Author: paulhsia <paulhsia@chromium.org>
Date: Thu May 31 19:26:00 2018

adhd: Fix memory leak in observer_unittest

(14/17 leaking tests for the issue. Total number is changed to 17 since
bt_device_unittest was not reported in the issue)

Remove cras_observer_client in DoObserverRemoveClear.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all observer_unittest

Change-Id: Ice287499dcb5aaf1ce04247713fa1fde2698e338
Reviewed-on: https://chromium-review.googlesource.com/1074801
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/0e9ac1a513e9f3f1226277ab86d5fb0900344d98/cras/src/tests/observer_unittest.cc

Project Member

Comment 29 by bugdroid1@chromium.org, May 31 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/1473be7bae96c6a9416f49eaab6b060157d379ee

commit 1473be7bae96c6a9416f49eaab6b060157d379ee
Author: paulhsia <paulhsia@chromium.org>
Date: Thu May 31 19:26:00 2018

adhd: Fix memory leaks in loopback_iodev_unittest

(15/17 leaking tests for the issue)

Initialize streams to NULL for frames_queued.
Free variable in TearDown.
Append nodes to iodev->nodes in cras_iodev_add_node for destroy.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all loopback_iodev_unittest

Change-Id: I111c0ab577a3f09d2a4c4b3caa0640032acb48c6
Reviewed-on: https://chromium-review.googlesource.com/1074802
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/1473be7bae96c6a9416f49eaab6b060157d379ee/cras/src/tests/loopback_iodev_unittest.cc

Project Member

Comment 30 by bugdroid1@chromium.org, May 31 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/e7df0e723745d0a089607ffa3d687b9351fc71ad

commit e7df0e723745d0a089607ffa3d687b9351fc71ad
Author: paulhsia <paulhsia@chromium.org>
Date: Thu May 31 19:26:01 2018

adhd: Fix memory leaks in polled_interval_checker_unittest

(16/17 leaking tests for the issue)

Destroy polled_interval in the end of some tests.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all pooled_interval_checker

Change-Id: I4cfb2937200ed9b6da5588bc0e0ec5e89525445b
Reviewed-on: https://chromium-review.googlesource.com/1074913
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/e7df0e723745d0a089607ffa3d687b9351fc71ad/cras/src/tests/polled_interval_checker_unittest.cc

Project Member

Comment 31 by bugdroid1@chromium.org, May 31 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/feb9007013975b3be96ad1dc64a5378d05588a2b

commit feb9007013975b3be96ad1dc64a5378d05588a2b
Author: paulhsia <paulhsia@chromium.org>
Date: Thu May 31 19:26:01 2018

adhd: Fix memory leaks in fmt_conv_unittest

(17/17 leaking tests for the issue)

Call cras_fmt_conv_destroy to destroy cras_fmt_conv.
Write random bytes to uninitialized buffers in linear_resampler function
stubs.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all fmt_conv_unittest

Change-Id: I727ef0c6c8720703b45a9c32d807af124c27fc17
Reviewed-on: https://chromium-review.googlesource.com/1074914
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/feb9007013975b3be96ad1dc64a5378d05588a2b/cras/src/tests/fmt_conv_unittest.cc

Owner: manojgupta@chromium.org
Hi manojgupta@,

All the changes are merge to tot now.
I used valgrind to check memory leaks locally.

Could you verify do they works for your settings?
I also like to try your checks, could you teach me how to run your reproduce steps?

Thanks!
Paul
Status: Fixed (was: Assigned)
Labels: -Pri-3 Merge-Request-68 Pri-2
Owner: paulhsia@chromium.org
Status: Started (was: Fixed)
These changes are memory leaks fixes for adhd.

Need to merge all to R68 for:
1. Lower memory usage of CRAS
2. Lower crash rate for CRAS

Thanks!
Project Member

Comment 35 by sheriffbot@chromium.org, Jun 2 2018

Labels: -Merge-Request-68 Hotlist-Merge-Approved Merge-Approved-68
Your change meets the bar and is auto-approved for M68. Please go ahead and merge the CL to branch 3440 manually. Please contact milestone owner if you have questions.
Owners: cmasso@(Android), kariahda@(iOS), bhthompson@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
paulhsia@ You can test the asan build as:
$ FEATURES=test USE=asan emerge-$BOARD adhd
 Issue 848469  has been merged into this issue.
Attaching latest asan logs.
Failures are a combination of issues related to:
1) Alignment
2) Shifts > 31 or < 0
3) Memory Leaks
asan_logs.tgz
2.8 KB Download
Project Member

Comment 40 by sheriffbot@chromium.org, Jun 5 2018

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 41 by bugdroid1@chromium.org, Jun 5 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/6d90a1c46b12a6cd516e9887b68ca338a55382f1

commit 6d90a1c46b12a6cd516e9887b68ca338a55382f1
Author: Manoj Gupta <manojgupta@google.com>
Date: Tue Jun 05 18:46:35 2018

cras: Fix some undefined shifts error.

Shifts of >=31 is undefined behavior for int types.
Change to unsigned type to silent some undefined behavior errors
coming from shift of 31.

BUG= chromium:844092 
TEST=Errors in cras_file_wait.c are gone.

Change-Id: I9d118d753a293acdc92982b55050cd8a5b208315
Reviewed-on: https://chromium-review.googlesource.com/1085887
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/6d90a1c46b12a6cd516e9887b68ca338a55382f1/cras/src/common/cras_file_wait.c

Project Member

Comment 42 by bugdroid1@chromium.org, Jun 6 2018

Labels: merge-merged-release-R68-10718.B
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/c737ee0099607924a94590b8c78d8976805e5ba6

commit c737ee0099607924a94590b8c78d8976805e5ba6
Author: paulhsia <paulhsia@chromium.org>
Date: Wed Jun 06 03:47:32 2018

adhd: Fix use after free in alert_unittest

(9/16 leaking tests for the issue)

Data will be freed after calling cras_alert_process_all_pending_alerts.
If we want to access the data, we should copy its value.

CRAS use the function and the data correctly in cras_observer.c.

Use structure instead of string to simulate how the CRAS use cras_alert
functions now.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alert_unittest

Change-Id: I6bafb8fd0aaf1d000f63a729752d66990bd108ea
Previous-Reviewed-on: https://chromium-review.googlesource.com/1071130
(cherry picked from commit eae126292a244a4034b092273ddb63edcd1f5dbd)
Signed-off-by: paulhsia <paulhsia@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088277

[modify] https://crrev.com/c737ee0099607924a94590b8c78d8976805e5ba6/cras/src/tests/alert_unittest.cc

Project Member

Comment 43 by bugdroid1@chromium.org, Jun 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/3bb34976e7c33664479d47f5d9c8cf75e45adfc0

commit 3bb34976e7c33664479d47f5d9c8cf75e45adfc0
Author: paulhsia <paulhsia@chromium.org>
Date: Wed Jun 06 03:47:33 2018

adhd: Fix memory leaks in dev_stream_unittest

(10/16 leaking tests for the issue)

Call dev_stream_destroy and byte_buffer_destroy for dev_stream and
conv_buffer in tests.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all dev_stream_unittest

Change-Id: I688bb9a69e04884f0e9765ce8d8b9ff8afe964c9
Previous-Reviewed-on: https://chromium-review.googlesource.com/1071414
(cherry picked from commit 792823a1842c52cbf2b6d0af544658a325b3b542)
Signed-off-by: paulhsia <paulhsia@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088278

[modify] https://crrev.com/3bb34976e7c33664479d47f5d9c8cf75e45adfc0/cras/src/tests/dev_stream_unittest.cc

Project Member

Comment 44 by bugdroid1@chromium.org, Jun 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/a3f9827a3555fc2e20f83375c7d1f072021310d5

commit a3f9827a3555fc2e20f83375c7d1f072021310d5
Author: paulhsia <paulhsia@chromium.org>
Date: Wed Jun 06 03:47:33 2018

adhd: Fix memory leak in cras_alsa_card

(11/16 leaking tests for the issue)

Free dev get from ucm_get_dev_for_mixer in filter_controls.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_card_unittest

Change-Id: I1d3012107b0c29148268fb076ebc27f9bd5c497b
Previous-Reviewed-on: https://chromium-review.googlesource.com/1073130
(cherry picked from commit 3f78af9950f9df6a2e6bb832b2c5dad60403c56c)
Signed-off-by: paulhsia <paulhsia@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088279

[modify] https://crrev.com/a3f9827a3555fc2e20f83375c7d1f072021310d5/cras/src/server/cras_alsa_card.c

Project Member

Comment 45 by bugdroid1@chromium.org, Jun 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/91eb1a5a35ddc0e893a3016126a15fea6d15f2c1

commit 91eb1a5a35ddc0e893a3016126a15fea6d15f2c1
Author: paulhsia <paulhsia@chromium.org>
Date: Wed Jun 06 03:47:34 2018

adhd: Fix memory leak in alsa_card_unittest

(11/16 leaking tests for the issue)

Call destroy for cras_alsa_card.
Initialize enum.
Remove unused ucm_section.
Make alsa stub functions snd_pcm_info_get_name and snd_pcm_info_get_id.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_card_unittest

Change-Id: I497db1ae9232d5e357f60973a21a6bef0aee78ec
Previous-Reviewed-on: https://chromium-review.googlesource.com/1073131
(cherry picked from commit 854469d18feb842581565bf8d91b0972c76efb28)
Signed-off-by: paulhsia <paulhsia@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088280

[modify] https://crrev.com/91eb1a5a35ddc0e893a3016126a15fea6d15f2c1/cras/src/tests/alsa_card_unittest.cc

Project Member

Comment 46 by bugdroid1@chromium.org, Jun 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/6b214537e9543085e5c28d968f3d43d1836c4100

commit 6b214537e9543085e5c28d968f3d43d1836c4100
Author: paulhsia <paulhsia@chromium.org>
Date: Wed Jun 06 03:47:35 2018

adhd: Fix memory leaks in cras_alsa_ucm

(12/16 leaking tests for the issue)

Free several local allocated char* in cras_alsa_ucm functions.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_ucm_unittest

Change-Id: I8e7b6b96da8a9b9e6523a3c1aadc8bb10a10e8e0
Previous-Reviewed-on: https://chromium-review.googlesource.com/1073347
(cherry picked from commit ad1abeee791b61b21fba6a684dd79fa44bd98bb2)
Signed-off-by: paulhsia <paulhsia@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088281

[modify] https://crrev.com/6b214537e9543085e5c28d968f3d43d1836c4100/cras/src/server/cras_alsa_ucm.c

Project Member

Comment 47 by bugdroid1@chromium.org, Jun 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/01de5de77de8a99377c401aadde6577d95c06df1

commit 01de5de77de8a99377c401aadde6577d95c06df1
Author: paulhsia <paulhsia@chromium.org>
Date: Wed Jun 06 03:50:12 2018

adhd: Fix memory leaks in alsa_ucm_unittest

(12/16 leaking tests for the issue)

Free several local allocated char* in tests in alsa_ucm_unittest.

BUG= chromium:844092 
TEST=Apply full patch set and run
FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all alsa_ucm_unittest

Change-Id: I7d92707cc7fa4f6d43281fc58aec7db1d114935b
Previous-Reviewed-on: https://chromium-review.googlesource.com/1073348
(cherry picked from commit 2af96b63796c109183c0f72340ea1ce97c713098)
Signed-off-by: paulhsia <paulhsia@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088282

[modify] https://crrev.com/01de5de77de8a99377c401aadde6577d95c06df1/cras/src/tests/alsa_ucm_unittest.cc

Project Member

Comment 48 by bugdroid1@chromium.org, Jun 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/fe91b1b773f0da31c51f399e274566b1e59d2c88

commit fe91b1b773f0da31c51f399e274566b1e59d2c88
Author: paulhsia <paulhsia@chromium.org>
Date: Wed Jun 06 03:50:13 2018

adhd: Fix memory leak in observer_unittest

(14/17 leaking tests for the issue. Total number is changed to 17 since
bt_device_unittest was not reported in the issue)

Remove cras_observer_client in DoObserverRemoveClear.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all observer_unittest

Change-Id: Ice287499dcb5aaf1ce04247713fa1fde2698e338
Previous-Reviewed-on: https://chromium-review.googlesource.com/1074801
(cherry picked from commit 0e9ac1a513e9f3f1226277ab86d5fb0900344d98)
Signed-off-by: paulhsia <paulhsia@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088283

[modify] https://crrev.com/fe91b1b773f0da31c51f399e274566b1e59d2c88/cras/src/tests/observer_unittest.cc

Project Member

Comment 49 by bugdroid1@chromium.org, Jun 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/d67e66d1c1ed422c8656a9e54206fb083459e241

commit d67e66d1c1ed422c8656a9e54206fb083459e241
Author: paulhsia <paulhsia@chromium.org>
Date: Wed Jun 06 03:50:14 2018

adhd: Fix memory leaks in polled_interval_checker_unittest

(16/17 leaking tests for the issue)

Destroy polled_interval in the end of some tests.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all pooled_interval_checker

Change-Id: I4cfb2937200ed9b6da5588bc0e0ec5e89525445b
Previous-Reviewed-on: https://chromium-review.googlesource.com/1074913
(cherry picked from commit e7df0e723745d0a089607ffa3d687b9351fc71ad)
Signed-off-by: paulhsia <paulhsia@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088285

[modify] https://crrev.com/d67e66d1c1ed422c8656a9e54206fb083459e241/cras/src/tests/polled_interval_checker_unittest.cc

Project Member

Comment 50 by bugdroid1@chromium.org, Jun 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/96cdc01ee0a22e4585c9e9054419bab51de304e8

commit 96cdc01ee0a22e4585c9e9054419bab51de304e8
Author: paulhsia <paulhsia@chromium.org>
Date: Wed Jun 06 03:50:14 2018

adhd: Fix memory leaks in loopback_iodev_unittest

(15/17 leaking tests for the issue)

Initialize streams to NULL for frames_queued.
Free variable in TearDown.
Append nodes to iodev->nodes in cras_iodev_add_node for destroy.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all loopback_iodev_unittest

Change-Id: I111c0ab577a3f09d2a4c4b3caa0640032acb48c6
Previous-Reviewed-on: https://chromium-review.googlesource.com/1074802
(cherry picked from commit 1473be7bae96c6a9416f49eaab6b060157d379ee)
Signed-off-by: paulhsia <paulhsia@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088284

[modify] https://crrev.com/96cdc01ee0a22e4585c9e9054419bab51de304e8/cras/src/tests/loopback_iodev_unittest.cc

Project Member

Comment 51 by bugdroid1@chromium.org, Jun 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/71fb8bf5cc120add1fb588e7a929a2e87dbc90fd

commit 71fb8bf5cc120add1fb588e7a929a2e87dbc90fd
Author: paulhsia <paulhsia@chromium.org>
Date: Wed Jun 06 03:50:15 2018

adhd: Fix memory leaks in fmt_conv_unittest

(17/17 leaking tests for the issue)

Call cras_fmt_conv_destroy to destroy cras_fmt_conv.
Write random bytes to uninitialized buffers in linear_resampler function
stubs.

BUG= chromium:844092 
TEST=FEATURES="test noclean nostrip" emerge-eve adhd
and
valgrind --leak-check=full --show-leak-kinds=all fmt_conv_unittest

Change-Id: I727ef0c6c8720703b45a9c32d807af124c27fc17
Previous-Reviewed-on: https://chromium-review.googlesource.com/1074914
(cherry picked from commit feb9007013975b3be96ad1dc64a5378d05588a2b)
Signed-off-by: paulhsia <paulhsia@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088326

[modify] https://crrev.com/71fb8bf5cc120add1fb588e7a929a2e87dbc90fd/cras/src/tests/fmt_conv_unittest.cc

 Issue 851010  has been merged into this issue.
Project Member

Comment 53 by sheriffbot@chromium.org, Jun 11 2018

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
These 3 tests are still failing as per builder logs:

adhd-0.0.1-r1522: FAIL: alsa_io_unittest
adhd-0.0.1-r1522: FAIL: dev_stream_unittest
adhd-0.0.1-r1522: FAIL: fmt_conv_unittest
amd64-generic-tot-asan-informational is still failing adhd unit tests 
https://cros-goldeneye.corp.google.com/chromeos/healthmonitoring/buildDetails?buildbucketId=8943115556220083152
Hi manojgupta@,

Not sure how to reproduce the failure.
I can pass the tests on both betty and amd64-generic with
FEATURES="test" emerge-$BOARD adhd locally.
Are you building with asan?
i.e. FEATURES=test USE=asan emerge-$BOARD adhd

Sign in to add a comment