[libdvbpsi-devel] src/dvbpsi.c: Dereference before null check (CID: 17272)

Jean-Paul Saman git at videolan.org
Wed Apr 16 15:53:32 CEST 2014


libdvbpsi | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Fri Apr 11 15:36:13 2014 +0200| [4b8f19f7b3b138af3ddfc10a64e566817ed305da] | committer: Jean-Paul Saman

src/dvbpsi.c: Dereference before null check (CID: 17272)

The assert() dereferenced the p_dvbpsi pointer before it was checked for null-value.

> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=4b8f19f7b3b138af3ddfc10a64e566817ed305da
---

 src/dvbpsi.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/dvbpsi.c b/src/dvbpsi.c
index a94bd5c..d441ee4 100644
--- a/src/dvbpsi.c
+++ b/src/dvbpsi.c
@@ -65,9 +65,10 @@ dvbpsi_t *dvbpsi_new(dvbpsi_message_cb callback, enum dvbpsi_msg_level level)
  *****************************************************************************/
 void dvbpsi_delete(dvbpsi_t *p_dvbpsi)
 {
-    assert(p_dvbpsi->p_decoder == NULL);
-    if (p_dvbpsi)
+    if (p_dvbpsi) {
+        assert(p_dvbpsi->p_decoder == NULL);
         p_dvbpsi->pf_message = NULL;
+    }
     free(p_dvbpsi);
 }
 



More information about the libdvbpsi-devel mailing list