Skip to content

Commit 08bf4d6

Browse files
author
Hiroshi Inoue
committed
Fix some memory leaks.
1 parent ebffbb4 commit 08bf4d6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/interfaces/odbc/environ.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ char rv = 1;
425425
if (conns[lf] && conns[lf]->henv == self)
426426
rv = rv && CC_Destructor(conns[lf]);
427427
}
428+
free(self);
428429

429430
mylog("exit EN_Destructor: rv = %d\n", rv);
430431
return rv;

src/interfaces/odbc/socket.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,18 @@ SocketClass *rv;
5858

5959
rv->buffer_in = (unsigned char *) malloc(globals.socket_buffersize);
6060
if ( ! rv->buffer_in)
61+
{
62+
free(rv);
6163
return NULL;
64+
}
6265

6366
rv->buffer_out = (unsigned char *) malloc(globals.socket_buffersize);
6467
if ( ! rv->buffer_out)
68+
{
69+
free(rv->buffer_in);
70+
free(rv);
6571
return NULL;
72+
}
6673

6774
rv->errormsg = NULL;
6875
rv->errornumber = 0;

0 commit comments

Comments
 (0)