vpnor: Fix SEGV fault in vpnor
Table object may throw error hence initialize table pointer to null so
that vpnor_free() doesn't free the junk pointer.
In vpnor_free() do not free table pointer if its null.
Added testcase to make sure the issue is fixed.
```
PASS: vpnor/test/toc_missing_file_reset
```
Change-Id: Ic6f4a7d163cf786d71b810190ab6ede0cd3a0717
Signed-off-by: Ninad Palsule <ninad@linux.ibm.com>
diff --git a/vpnor/test/Makefile.am.include b/vpnor/test/Makefile.am.include
index dbbf3fc..fb9bef7 100644
--- a/vpnor/test/Makefile.am.include
+++ b/vpnor/test/Makefile.am.include
@@ -136,6 +136,13 @@
vpnor_test_toc_missing_file_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
vpnor_test_toc_missing_file_LDADD = $(VPNOR_LDADD)
+vpnor_test_toc_missing_file_reset_SOURCES = \
+ $(TEST_MOCK_VPNOR_SRCS) \
+ $(TEST_MBOX_VPNOR_INTEG_SRCS) \
+ %reldir%/toc_missing_file_reset.cpp
+vpnor_test_toc_missing_file_reset_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
+vpnor_test_toc_missing_file_reset_LDADD = $(VPNOR_LDADD)
+
vpnor_test_create_read_window_oob_SOURCES = \
$(TEST_MOCK_VPNOR_SRCS) \
$(TEST_MBOX_VPNOR_INTEG_SRCS) \
@@ -252,6 +259,7 @@
%reldir%/toc_lookup_found \
%reldir%/toc_lookup_failed \
%reldir%/toc_missing_file \
+ %reldir%/toc_missing_file_reset \
%reldir%/create_read_window_oob \
%reldir%/create_read_window_toc \
%reldir%/create_read_window_straddle_partitions \