Commit 2252c481 authored by Matteo Quintiliani's avatar Matteo Quintiliani

Added NULL assignment to pointer after free()


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@971 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent c75d402c
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxp.c,v 1.79 2008-03-27 12:03:11 mtheo Exp $ * $Id: nmxp.c,v 1.80 2008-03-28 07:32:31 mtheo Exp $
* *
*/ */
...@@ -110,6 +110,7 @@ int nmxp_sendAddTimeSeriesChannel_raw(int isock, NMXP_CHAN_LIST_NET *channelList ...@@ -110,6 +110,7 @@ int nmxp_sendAddTimeSeriesChannel_raw(int isock, NMXP_CHAN_LIST_NET *channelList
if(buffer) { if(buffer) {
free(buffer); free(buffer);
buffer = NULL;
} }
return ret; return ret;
} }
...@@ -383,6 +384,7 @@ int nmxp_waitReady(int isock) { ...@@ -383,6 +384,7 @@ int nmxp_waitReady(int isock) {
str_msg); str_msg);
if(buf_app) { if(buf_app) {
free(buf_app); free(buf_app);
buf_app = NULL;
} }
/* Close the socket*/ /* Close the socket*/
nmxp_closeSocket(isock); nmxp_closeSocket(isock);
...@@ -398,6 +400,7 @@ int nmxp_waitReady(int isock) { ...@@ -398,6 +400,7 @@ int nmxp_waitReady(int isock) {
rc = nmxp_recv_ctrl(isock, buf_app, length, 0, &recv_errno); rc = nmxp_recv_ctrl(isock, buf_app, length, 0, &recv_errno);
if(buf_app) { if(buf_app) {
free(buf_app); free(buf_app);
buf_app = NULL;
} }
} }
} }
...@@ -493,6 +496,7 @@ NMXP_CHAN_LIST *nmxp_getAvailableChannelList(char * hostname, int portnum, NMXP_ ...@@ -493,6 +496,7 @@ NMXP_CHAN_LIST *nmxp_getAvailableChannelList(char * hostname, int portnum, NMXP_
if(channelList) { if(channelList) {
free(channelList); free(channelList);
channelList = NULL;
} }
return channelList_subset; return channelList_subset;
...@@ -702,19 +706,25 @@ void nmxp_raw_stream_init(NMXP_RAW_STREAM_DATA *raw_stream_buffer, int32_t max_t ...@@ -702,19 +706,25 @@ void nmxp_raw_stream_init(NMXP_RAW_STREAM_DATA *raw_stream_buffer, int32_t max_t
void nmxp_raw_stream_free(NMXP_RAW_STREAM_DATA *raw_stream_buffer) { void nmxp_raw_stream_free(NMXP_RAW_STREAM_DATA *raw_stream_buffer) {
int j; int j;
if(raw_stream_buffer->pdlist) { if(raw_stream_buffer) {
for(j=0; j<raw_stream_buffer->max_pdlist_items; j++) { if(raw_stream_buffer->pdlist) {
if(raw_stream_buffer->pdlist[j]) { for(j=0; j<raw_stream_buffer->max_pdlist_items; j++) {
if(raw_stream_buffer->pdlist[j]->buffer) { if(raw_stream_buffer->pdlist[j]) {
free(raw_stream_buffer->pdlist[j]->buffer); if(raw_stream_buffer->pdlist[j]->buffer) {
} free(raw_stream_buffer->pdlist[j]->buffer);
if(raw_stream_buffer->pdlist[j]->pDataPtr) { raw_stream_buffer->pdlist[j]->buffer = NULL;
free(raw_stream_buffer->pdlist[j]->pDataPtr); }
if(raw_stream_buffer->pdlist[j]->pDataPtr) {
free(raw_stream_buffer->pdlist[j]->pDataPtr);
raw_stream_buffer->pdlist[j]->pDataPtr = NULL;
}
free(raw_stream_buffer->pdlist[j]);
raw_stream_buffer->pdlist[j] = NULL;
} }
free(raw_stream_buffer->pdlist[j]);
} }
free(raw_stream_buffer->pdlist);
raw_stream_buffer->pdlist = NULL;
} }
free(raw_stream_buffer->pdlist);
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxp_chan.c,v 1.38 2008-03-12 08:30:40 mtheo Exp $ * $Id: nmxp_chan.c,v 1.39 2008-03-28 07:32:31 mtheo Exp $
* *
*/ */
...@@ -67,6 +67,7 @@ int nmxp_chan_cpy_sta_chan(const char *net_dot_station_dot_channel, char *statio ...@@ -67,6 +67,7 @@ int nmxp_chan_cpy_sta_chan(const char *net_dot_station_dot_channel, char *statio
if(tmp_name) { if(tmp_name) {
free(tmp_name); free(tmp_name);
tmp_name = NULL;
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment