cvsuser 03/10/30 00:49:14
Modified: io io.c io_unix.c
Log:
remove some warnings
Revision Changes Path
1.70 +2 -2 parrot/io/io.c
Index: io.c
===================================================================
RCS file: /cvs/public/parrot/io/io.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -w -r1.69 -r1.70
--- io.c 30 Oct 2003 06:01:53 -0000 1.69
+++ io.c 30 Oct 2003 08:49:14 -0000 1.70
@@ -1,7 +1,7 @@
/* io.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: io.c,v 1.69 2003/10/30 06:01:53 mrjoltcola Exp $
+ * $Id: io.c,v 1.70 2003/10/30 08:49:14 leo Exp $
* Overview:
* This is the Parrot IO subsystem API. Generic IO stuff
* goes here, each specific layer goes in its own file...
@@ -357,7 +357,7 @@
if (!PMC_IS_NULL(pmc)) {
if (!io)
- return -1;
+ return 0;
layer = io->stack;
if (layer) {
io->stack = layer->down;
1.41 +23 -23 parrot/io/io_unix.c
Index: io_unix.c
===================================================================
RCS file: /cvs/public/parrot/io/io_unix.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -w -r1.40 -r1.41
--- io_unix.c 30 Oct 2003 06:44:03 -0000 1.40
+++ io_unix.c 30 Oct 2003 08:49:14 -0000 1.41
@@ -1,7 +1,7 @@
/* io_unix.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: io_unix.c,v 1.40 2003/10/30 06:44:03 mrjoltcola Exp $
+ * $Id: io_unix.c,v 1.41 2003/10/30 08:49:14 leo Exp $
* Overview:
* This is the Parrot IO UNIX layer. May be changed to
* include other platforms if that platform is similar
@@ -440,11 +440,10 @@
STRING *
PIO_sockaddr_in(theINTERP, unsigned short port, STRING * addr)
{
- STRING * packed;
struct sockaddr_in sa;
/* XXX: Fixme, inet_addr obsolete, replace with inet_aton */
char * s = string_to_cstring(interpreter, addr);
- if(inet_aton(s, &sa.sin_addr.s_addr) != 0) {
+ if(inet_aton(s, &sa.sin_addr) != 0) {
/* Success converting numeric IP */
}
else {
@@ -455,19 +454,19 @@
struct hostent *he = gethostbyname(s);
/* XXX FIXME - Handle error condition better */
if(!he) {
+ string_cstring_free(s);
fprintf(stderr, "gethostbyname failure [%s]\n", s);
- return packed;
+ return NULL;
}
memcpy((char*)&sa.sin_addr, he->h_addr, sizeof(sa.sin_addr));
}
+ string_cstring_free(s);
+
sa.sin_port = htons(port);
fprintf(stderr, "sockaddr_in: port %d\n", port);
- packed = string_make(interpreter, &sa, sizeof(struct sockaddr), NULL, 0,
+ return string_make(interpreter, &sa, sizeof(struct sockaddr), NULL, 0,
NULL);
- if(!packed)
- PANIC("unix_sockaddr: failed to create string");
- return packed;
}
#if PARROT_NET_DEVEL
@@ -704,6 +703,7 @@
ParrotIO *io;
int pid, err, fds[2];
char *ccmd = string_to_cstring(interpreter, cmd);
+ /* FIXME mem leak here */
if((err = pipe(fds)) < 0) {
perror("pipe:");