Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions source/protocol/http/curlinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <curl/curl.h>
#include <signal.h>

#include "../xconf-client/multicurlinterface.h"
#include "curlinterface.h"
#include "reportprofiles.h"
#include "t2MtlsUtils.h"
Expand Down Expand Up @@ -332,7 +333,7 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid)
pid_t childPid;
int sharedPipeFds[2];

T2Debug("%s ++in\n", __FUNCTION__);
T2Info("%s ++in\n", __FUNCTION__);
if(httpUrl == NULL || payload == NULL)
{
return ret;
Expand Down Expand Up @@ -441,18 +442,24 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid)
*/
if(childPid == 0)
{
curl = curl_easy_init();
int idx;
T2ERROR ret = acquire_pool_handle(&curl, &idx);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Uninitialized scalar variable

Using uninitialized value "idx" when calling "acquire_pool_handle".

High Impact, CWE-457
UNINIT

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Uninitialized scalar variable

Using uninitialized value "idx" when calling "acquire_pool_handle".

High Impact, CWE-457
UNINIT

if (ret != T2ERROR_SUCCESS)
{
return ret;
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Resource leak

Variable "pCertFile" going out of scope leaks the storage it points to.

High Impact, CWE-404
RESOURCE_LEAK

}

if(curl)
{
childCurlResponse.curlStatus = true;
if(setHeader(curl, httpUrl, &headerList, &childCurlResponse) != T2ERROR_SUCCESS)
{
curl_easy_cleanup(curl);
//curl_easy_cleanup(curl);
goto child_cleanReturn;
}
if (setPayload(curl, payload, &childCurlResponse) != T2ERROR_SUCCESS)
{
curl_easy_cleanup(curl); // CID 189985: Resource leak
//curl_easy_cleanup(curl); // CID 189985: Resource leak
goto child_cleanReturn;
}
#ifdef LIBRDKCERTSEL_BUILD
Expand All @@ -467,7 +474,7 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid)
}
if(code != CURLE_OK)
{
curl_easy_cleanup(curl);
//curl_easy_cleanup(curl);
goto child_cleanReturn;
}
do
Expand All @@ -480,7 +487,7 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid)
{
T2Error("%s, T2:Failed to retrieve the certificate.\n", __func__);
curlCertSelectorFree();
curl_easy_cleanup(curl);
//curl_easy_cleanup(curl);
goto child_cleanReturn;
}
else
Expand All @@ -494,7 +501,7 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid)
#endif
if((mtls_enable == true) && (setMtlsHeaders(curl, pCertFile, pCertPC, &childCurlResponse) != T2ERROR_SUCCESS))
{
curl_easy_cleanup(curl); // CID 189985: Resource leak
//curl_easy_cleanup(curl); // CID 189985: Resource leak
goto child_cleanReturn;
}
pthread_once(&curlFileMutexOnce, sendOverHTTPInit);
Expand Down Expand Up @@ -537,12 +544,13 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid)
while(rdkcertselector_setCurlStatus(thisCertSel, curl_code, (const char*)httpUrl) == TRY_ANOTHER);
#endif
curl_slist_free_all(headerList);
curl_easy_cleanup(curl);
//curl_easy_cleanup(curl);
}
else
{
childCurlResponse.curlStatus = false;
}
release_pool_handle(idx);

child_cleanReturn :
#ifndef LIBRDKCERTSEL_BUILD
Expand Down Expand Up @@ -571,6 +579,7 @@ child_cleanReturn :
T2Error("unable to write \n");
}
close(sharedPipeFds[1]);
release_pool_handle(idx);
exit(0);

}
Expand Down Expand Up @@ -624,7 +633,7 @@ child_cleanReturn :
ret = T2ERROR_SUCCESS;
T2Info("Report Sent Successfully over HTTP : %ld\n", childCurlResponse.http_code);
}
T2Debug("%s --out\n", __FUNCTION__);
T2Info("%s --out\n", __FUNCTION__);
return ret;
}

Expand Down
3 changes: 3 additions & 0 deletions source/telemetry2_0.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in source/telemetry2_0.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/telemetry2_0.c' (Match: rdkb/components/generic/CcspLogAgent/rdkb/components/generic/CcspLogAgent/1, 157 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/generic/CcspLogAgent/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: source/LogComponent/ssp_main.c)
*
* Copyright 2019 RDK Management
*
Expand Down Expand Up @@ -45,6 +45,7 @@
#include "scheduler.h"
#include "t2eventreceiver.h"
#include "t2common.h"
#include "multicurlinterface.h"

#ifdef INCLUDE_BREAKPAD
#ifndef ENABLE_RDKC_SUPPORT
Expand Down Expand Up @@ -72,6 +73,7 @@
T2Debug("%s ++in\n", __FUNCTION__);

initWhoamiSupport();
init_connection_pool();
if(T2ERROR_SUCCESS == initReportProfiles())
{
#ifndef DEVICE_EXTENDER
Expand Down Expand Up @@ -125,6 +127,7 @@
#endif
ReportProfiles_uninit();
}
http_pool_cleanup();

}
static void _print_stack_backtrace(void)
Expand Down
2 changes: 1 addition & 1 deletion source/xconf-client/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AM_CFLAGS =

lib_LTLIBRARIES = libxconfclient.la

libxconfclient_la_SOURCES = xconfclient.c
libxconfclient_la_SOURCES = xconfclient.c multicurlinterface.c
libxconfclient_la_LDFLAGS = -shared -fPIC -lcjson -lcurl
if IS_LIBRDKCERTSEL_ENABLED
libxconfclient_la_CFLAGS = $(LIBRDKCERTSEL_FLAG)
Expand Down
Loading
Loading