SF Bug Tracker id 3496938 - Missing structures initialisation in some functions
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 01:31:16 PST
Memsetting to 0 some of the structures: finfo in process_request,
job in readFromSSDPSocket, request in http_OpenHttpGetEx, job in
genaNotifyThread, job in genaNotifyAllExt, job in genaNotifyAll,
job in genaInitNotifyExt, job in genaInitNotify, LocalAddr in
getlocalhostname.
(cherry picked from commit 7301f46269
)
This commit is contained in:
parent
f25c62e65c
commit
1dbcdaef98
12
ChangeLog
12
ChangeLog
@ -299,6 +299,18 @@ Version 1.8.0
|
|||||||
Version 1.6.16
|
Version 1.6.16
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
|
2012-03-05 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
|
||||||
|
|
||||||
|
SF Bug Tracker id 3496938 - Missing structures initialisation in some functions
|
||||||
|
|
||||||
|
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 01:31:16 PST
|
||||||
|
|
||||||
|
Memsetting to 0 some of the structures: finfo in process_request,
|
||||||
|
job in readFromSSDPSocket, request in http_OpenHttpGetEx, job in
|
||||||
|
genaNotifyThread, job in genaNotifyAllExt, job in genaNotifyAll,
|
||||||
|
job in genaInitNotifyExt, job in genaInitNotify, LocalAddr in
|
||||||
|
getlocalhostname.
|
||||||
|
|
||||||
2012-03-05 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
|
2012-03-05 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
|
||||||
|
|
||||||
SF Bug Tracker id 3496934 - Memory leaks in getlocalhostname and UpnpGetIfInfo
|
SF Bug Tracker id 3496934 - Memory leaks in getlocalhostname and UpnpGetIfInfo
|
||||||
|
@ -1645,6 +1645,8 @@ int UpnpSendAdvertisementLowPower(UpnpDevice_Handle Hnd, int Exp,
|
|||||||
upnp_timeout *adEvent;
|
upnp_timeout *adEvent;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
if( UpnpSdkInit != 1 ) {
|
if( UpnpSdkInit != 1 ) {
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
}
|
}
|
||||||
@ -1865,6 +1867,8 @@ int UpnpSubscribeAsync(
|
|||||||
char *EvtUrl = ( char * )EvtUrl_const;
|
char *EvtUrl = ( char * )EvtUrl_const;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
if( UpnpSdkInit != 1 ) {
|
if( UpnpSdkInit != 1 ) {
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
}
|
}
|
||||||
@ -2042,6 +2046,8 @@ int UpnpUnSubscribeAsync(
|
|||||||
struct Handle_Info *SInfo = NULL;
|
struct Handle_Info *SInfo = NULL;
|
||||||
struct UpnpNonblockParam *Param;
|
struct UpnpNonblockParam *Param;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, "Inside UpnpUnSubscribeAsync\n");
|
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, "Inside UpnpUnSubscribeAsync\n");
|
||||||
|
|
||||||
if (UpnpSdkInit != 1) {
|
if (UpnpSdkInit != 1) {
|
||||||
@ -2154,6 +2160,8 @@ int UpnpRenewSubscriptionAsync(
|
|||||||
struct Handle_Info *SInfo = NULL;
|
struct Handle_Info *SInfo = NULL;
|
||||||
struct UpnpNonblockParam *Param;
|
struct UpnpNonblockParam *Param;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
if( UpnpSdkInit != 1 ) {
|
if( UpnpSdkInit != 1 ) {
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
}
|
}
|
||||||
@ -2585,6 +2593,8 @@ int UpnpSendActionAsync(
|
|||||||
/* udn not used? */
|
/* udn not used? */
|
||||||
/*char *DevUDN = (char *)DevUDN_const;*/
|
/*char *DevUDN = (char *)DevUDN_const;*/
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
if(UpnpSdkInit != 1) {
|
if(UpnpSdkInit != 1) {
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
}
|
}
|
||||||
@ -2670,6 +2680,8 @@ int UpnpSendActionExAsync(
|
|||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
if( UpnpSdkInit != 1 ) {
|
if( UpnpSdkInit != 1 ) {
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
}
|
}
|
||||||
@ -2772,6 +2784,8 @@ int UpnpGetServiceVarStatusAsync(
|
|||||||
char *ActionURL = (char *)ActionURL_const;
|
char *ActionURL = (char *)ActionURL_const;
|
||||||
char *VarName = (char *)VarName_const;
|
char *VarName = (char *)VarName_const;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
if( UpnpSdkInit != 1 ) {
|
if( UpnpSdkInit != 1 ) {
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
}
|
}
|
||||||
@ -3722,6 +3736,8 @@ int getlocalhostname(char *out, size_t out_len)
|
|||||||
struct hostent *h = NULL;
|
struct hostent *h = NULL;
|
||||||
struct sockaddr_in LocalAddr;
|
struct sockaddr_in LocalAddr;
|
||||||
|
|
||||||
|
memset(&LocalAddr, 0, sizeof(LocalAddr));
|
||||||
|
|
||||||
gethostname(out, out_len);
|
gethostname(out, out_len);
|
||||||
h = gethostbyname(out);
|
h = gethostbyname(out);
|
||||||
if (h != NULL) {
|
if (h != NULL) {
|
||||||
@ -3796,6 +3812,7 @@ int getlocalhostname(char *out, size_t out_len)
|
|||||||
memset(&ifConf, 0, sizeof(ifConf));
|
memset(&ifConf, 0, sizeof(ifConf));
|
||||||
memset(&ifReq, 0, sizeof(ifReq));
|
memset(&ifReq, 0, sizeof(ifReq));
|
||||||
memset(szBuffer, 0, sizeof(szBuffer));
|
memset(szBuffer, 0, sizeof(szBuffer));
|
||||||
|
memset(&LocalAddr, 0, sizeof(LocalAddr));
|
||||||
|
|
||||||
/* Create an unbound datagram socket to do the SIOCGIFADDR ioctl on. */
|
/* Create an unbound datagram socket to do the SIOCGIFADDR ioctl on. */
|
||||||
LocalSock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
LocalSock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2012 France Telecom All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -138,6 +139,8 @@ static int ScheduleGenaAutoRenew(
|
|||||||
int return_code = GENA_SUCCESS;
|
int return_code = GENA_SUCCESS;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
if (TimeOut == UPNP_INFINITE) {
|
if (TimeOut == UPNP_INFINITE) {
|
||||||
return_code = GENA_SUCCESS;
|
return_code = GENA_SUCCESS;
|
||||||
goto end_function;
|
goto end_function;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2012 France Telecom All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -315,6 +316,8 @@ static void genaNotifyThread(
|
|||||||
struct Handle_Info *handle_info;
|
struct Handle_Info *handle_info;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
/* This should be a HandleLock and not a HandleReadLock otherwise if there
|
/* This should be a HandleLock and not a HandleReadLock otherwise if there
|
||||||
* is a lot of notifications, then multiple threads will acquire a read
|
* is a lot of notifications, then multiple threads will acquire a read
|
||||||
* lock and the thread which sends the notification will be blocked forever
|
* lock and the thread which sends the notification will be blocked forever
|
||||||
@ -463,6 +466,8 @@ int genaInitNotify(
|
|||||||
struct Handle_Info *handle_info;
|
struct Handle_Info *handle_info;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
|
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENA BEGIN INITIAL NOTIFY");
|
"GENA BEGIN INITIAL NOTIFY");
|
||||||
|
|
||||||
@ -616,6 +621,8 @@ int genaInitNotifyExt(
|
|||||||
struct Handle_Info *handle_info;
|
struct Handle_Info *handle_info;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
|
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENA BEGIN INITIAL NOTIFY EXT");
|
"GENA BEGIN INITIAL NOTIFY EXT");
|
||||||
|
|
||||||
@ -769,6 +776,8 @@ int genaNotifyAllExt(
|
|||||||
struct Handle_Info *handle_info;
|
struct Handle_Info *handle_info;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
|
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENA BEGIN NOTIFY ALL EXT");
|
"GENA BEGIN NOTIFY ALL EXT");
|
||||||
|
|
||||||
@ -908,6 +917,8 @@ int genaNotifyAll(
|
|||||||
struct Handle_Info *handle_info;
|
struct Handle_Info *handle_info;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
|
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENA BEGIN NOTIFY ALL");
|
"GENA BEGIN NOTIFY ALL");
|
||||||
|
|
||||||
|
@ -260,6 +260,8 @@ static UPNP_INLINE void schedule_request_job(
|
|||||||
struct mserv_request_t *request;
|
struct mserv_request_t *request;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
request = (struct mserv_request_t *)malloc(
|
request = (struct mserv_request_t *)malloc(
|
||||||
sizeof (struct mserv_request_t));
|
sizeof (struct mserv_request_t));
|
||||||
if (request == NULL) {
|
if (request == NULL) {
|
||||||
@ -846,6 +848,8 @@ int StartMiniServer(
|
|||||||
MiniServerSockArray *miniSocket;
|
MiniServerSockArray *miniSocket;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
if (gMServState != MSERV_IDLE) {
|
if (gMServState != MSERV_IDLE) {
|
||||||
/* miniserver running. */
|
/* miniserver running. */
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2012 France Telecom All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -1786,6 +1787,8 @@ int http_OpenHttpGetEx(
|
|||||||
/* char rangeBuf[SIZE_RANGE_BUFFER]; */
|
/* char rangeBuf[SIZE_RANGE_BUFFER]; */
|
||||||
struct SendInstruction rangeBuf;
|
struct SendInstruction rangeBuf;
|
||||||
|
|
||||||
|
membuffer_init(&request);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* Checking Input parameters */
|
/* Checking Input parameters */
|
||||||
if (!url_str || !Handle || !contentType || !httpStatus ) {
|
if (!url_str || !Handle || !contentType || !httpStatus ) {
|
||||||
|
@ -1013,6 +1013,7 @@ static int process_request(
|
|||||||
req->method == HTTPMETHOD_POST ||
|
req->method == HTTPMETHOD_POST ||
|
||||||
req->method == HTTPMETHOD_SIMPLEGET);
|
req->method == HTTPMETHOD_SIMPLEGET);
|
||||||
/* init */
|
/* init */
|
||||||
|
memset(&finfo, 0, sizeof(finfo));
|
||||||
request_doc = NULL;
|
request_doc = NULL;
|
||||||
finfo = UpnpFileInfo_new();
|
finfo = UpnpFileInfo_new();
|
||||||
alias_grabbed = FALSE;
|
alias_grabbed = FALSE;
|
||||||
|
@ -99,6 +99,8 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
|||||||
SSDPResultData *threadData = NULL;
|
SSDPResultData *threadData = NULL;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
/* we are assuming that there can be only one client supported at a time */
|
/* we are assuming that there can be only one client supported at a time */
|
||||||
HandleReadLock();
|
HandleReadLock();
|
||||||
|
|
||||||
@ -457,6 +459,8 @@ int SearchByTarget(int Mx, char *St, void *Cookie)
|
|||||||
/*ThreadData *ThData; */
|
/*ThreadData *ThData; */
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
requestType = ssdp_request_type1(St);
|
requestType = ssdp_request_type1(St);
|
||||||
if (requestType == SSDP_SERROR)
|
if (requestType == SSDP_SERROR)
|
||||||
return UPNP_E_INVALID_PARAM;
|
return UPNP_E_INVALID_PARAM;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (C) 2011 France Telecom All rights reserved.
|
* Copyright (C) 2011-2012 France Telecom All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -90,6 +90,8 @@ void ssdp_handle_device_request(http_message_t *hmsg, struct sockaddr_storage *d
|
|||||||
int replyTime;
|
int replyTime;
|
||||||
int maxAge;
|
int maxAge;
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
/* check man hdr. */
|
/* check man hdr. */
|
||||||
if (httpmsg_find_hdr(hmsg, HDR_MAN, &hdr_value) == NULL ||
|
if (httpmsg_find_hdr(hmsg, HDR_MAN, &hdr_value) == NULL ||
|
||||||
memptr_cmp(&hdr_value, "\"ssdp:discover\"") != 0)
|
memptr_cmp(&hdr_value, "\"ssdp:discover\"") != 0)
|
||||||
|
@ -688,6 +688,8 @@ void readFromSSDPSocket(SOCKET socket)
|
|||||||
ssize_t byteReceived = 0;
|
ssize_t byteReceived = 0;
|
||||||
char ntop_buf[64];
|
char ntop_buf[64];
|
||||||
|
|
||||||
|
memset(&job, 0, sizeof(job));
|
||||||
|
|
||||||
requestBuf = staticBuf;
|
requestBuf = staticBuf;
|
||||||
/* in case memory can't be allocated, still drain the socket using a
|
/* in case memory can't be allocated, still drain the socket using a
|
||||||
* static buffer. */
|
* static buffer. */
|
||||||
|
Loading…
Reference in New Issue
Block a user