]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
format.c: correct possible null pointer dereference
authorScott Griepentrog <sgriepentrog@digium.com>
Fri, 14 Feb 2014 21:27:09 +0000 (21:27 +0000)
committerScott Griepentrog <sgriepentrog@digium.com>
Fri, 14 Feb 2014 21:27:09 +0000 (21:27 +0000)
In ast_format_sdp_parse and ast_format_sdp_generate
the check checks for a valid interface and function
were potentially confusing, and hid an error in the
test of the presence of the function that is called
later.  This patch clears up and corrects the test.

Review: https://reviewboard.asterisk.org/r/3208/
(closes issue ASTERISK-23098)
Reported by: marcelloceschia
Patches:
     main_format.patch uploaded by marcelloceschia (license 6036)
 ASTERISK-23098.patch uploaded by coreyfarrell (license 5909)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@408137 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/format.c

index d04eb054d1114d853e560e35a2a8e50b17ffc105..d7fa744fb8b94b0c4b2d440a46cefd3d5255b494 100644 (file)
@@ -129,7 +129,7 @@ int ast_format_sdp_parse(struct ast_format *format, const char *attributes)
        }
 
        ao2_rdlock(wrapper);
-       if (!(wrapper->interface || !wrapper->interface->format_attr_sdp_parse)) {
+       if (!wrapper->interface || !wrapper->interface->format_attr_sdp_parse) {
                ao2_unlock(wrapper);
                ao2_ref(wrapper, -1);
                return 0;
@@ -152,7 +152,7 @@ void ast_format_sdp_generate(const struct ast_format *format, unsigned int paylo
        }
 
        ao2_rdlock(wrapper);
-       if (!(wrapper->interface || !wrapper->interface->format_attr_sdp_generate)) {
+       if (!wrapper->interface || !wrapper->interface->format_attr_sdp_generate) {
                ao2_unlock(wrapper);
                ao2_ref(wrapper, -1);
                return;