aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-05-14 21:29:39 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-05-14 21:29:39 +0200
commite9c241061626a05f5e198d6bd98fc508db46c81e (patch)
treedcb8282d57516944763f4ec7758c9bce07f7f56e
parent23f5d4758f3a2e6ae65bae8b6f9fe00b77c84ce4 (diff)
downloaddabmux-e9c241061626a05f5e198d6bd98fc508db46c81e.tar.gz
dabmux-e9c241061626a05f5e198d6bd98fc508db46c81e.tar.bz2
dabmux-e9c241061626a05f5e198d6bd98fc508db46c81e.zip
Add check on ptr in dabInputUdp
-rw-r--r--src/dabInputUdp.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dabInputUdp.cpp b/src/dabInputUdp.cpp
index f6fda1e..29e090d 100644
--- a/src/dabInputUdp.cpp
+++ b/src/dabInputUdp.cpp
@@ -68,6 +68,8 @@ int dabInputUdpOpen(void* args, const char* inputName)
char* address;
char* ptr;
long port;
+ dabInputUdpData* input = (dabInputUdpData*)args;
+
address = strdup(inputName);
ptr = strchr(address, ':');
if (ptr == NULL) {
@@ -75,6 +77,7 @@ int dabInputUdpOpen(void* args, const char* inputName)
"\"%s\" is an invalid format for udp address: "
"should be [address]:port - > aborting\n", address);
returnCode = -1;
+ goto udpopen_ptr_null_out;
}
*(ptr++) = 0;
port = strtol(ptr, (char **)NULL, 10);
@@ -88,7 +91,6 @@ int dabInputUdpOpen(void* args, const char* inputName)
etiLog.log(error, "can't use port number 0 in udp address\n");
returnCode = -1;
}
- dabInputUdpData* input = (dabInputUdpData*)args;
if (input->socket->create(port) == -1) {
etiLog.log(error, "can't set port %i on Udp input (%s: %s)\n",
port, inetErrDesc, inetErrMsg);
@@ -110,9 +112,10 @@ int dabInputUdpOpen(void* args, const char* inputName)
returnCode = -1;
}
+udpopen_ptr_null_out:
free(address);
etiLog.log(debug, "check return code of create\n");
- return returnCode;;
+ return returnCode;
}