From e9c241061626a05f5e198d6bd98fc508db46c81e Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 14 May 2014 21:29:39 +0200 Subject: Add check on ptr in dabInputUdp --- src/dabInputUdp.cpp | 7 +++++-- 1 file 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; } -- cgit v1.2.3