Skip to content

Commit

Permalink
pcap-file: Fix memory leak in ovs_pcap_open().
Browse files Browse the repository at this point in the history
In ovs_pcap_open(), we allocate memory for the 'p_file'
structure but not released when fopen fails.

Addresses-Coverity: ("Resource leak")
Fixes: b6e840a ("pcap-file: Add nanosecond resolution pcap support.")
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
wyjwang authored and igsilya committed Sep 15, 2021
1 parent 22c95f9 commit 3168f32
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/pcap-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ ovs_pcap_open(const char *file_name, const char *mode)
: mode[0] == 'w' ? "writing"
: "appending"),
ovs_strerror(errno));
free(p_file);
return NULL;
}

Expand Down

0 comments on commit 3168f32

Please sign in to comment.