- Check for failure when putting the packet in the ast_str
authorRussell Bryant <russell@russellbryant.com>
Sat, 8 Nov 2008 21:46:43 +0000 (21:46 +0000)
committerRussell Bryant <russell@russellbryant.com>
Sat, 8 Nov 2008 21:46:43 +0000 (21:46 +0000)
 - fix a spelling error in a header file

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

channels/chan_sip.c
include/asterisk/strings.h

index 4ef90c7..06d8d6f 100644 (file)
@@ -20132,10 +20132,16 @@ static int sipsock_read(int *id, int fd, short events, void *ignore)
                        ast_log(LOG_WARNING, "Recv error: %s\n", strerror(errno));
                return 1;
        }
+
        readbuf[res] = '\0';
-       if (!(req.data = ast_str_create(SIP_MIN_PACKET)))
+
+       if (!(req.data = ast_str_create(SIP_MIN_PACKET))) {
                return 1;
-       ast_str_set(&req.data, 0, "%s", readbuf);
+       }
+
+       if (ast_str_set(&req.data, 0, "%s", readbuf) == AST_DYNSTR_BUILD_FAILED) {
+               return -1;
+       }
 
        req.socket.fd   = sipsock;
        req.socket.type = SIP_TRANSPORT_UDP;
index b0ab9c4..6c5eba7 100644 (file)
@@ -569,7 +569,7 @@ struct ast_str *__ast_str_thread_get(struct ast_threadstorage *ts,
  * interface simplified).
  */
 enum {
-       /*! An error has occured and the contents of the dynamic string
+       /*! An error has occurred and the contents of the dynamic string
         *  are undefined */
        AST_DYNSTR_BUILD_FAILED = -1,
        /*! The buffer size for the dynamic string had to be increased, and