author | erik <erik> | 2007-01-24 19:46:19 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-24 19:46:19 (UTC) |
commit | a017bf21dd89159052f2f7a3fbc043a24956c08c (patch) (unidiff) | |
tree | 008be2b62ee5487dc55b8a7c7f043c94268f8362 /noncore/net | |
parent | a4a7bd22feb060a80e20c81cded43cc24f5cd423 (diff) | |
download | opie-a017bf21dd89159052f2f7a3fbc043a24956c08c.zip opie-a017bf21dd89159052f2f7a3fbc043a24956c08c.tar.gz opie-a017bf21dd89159052f2f7a3fbc043a24956c08c.tar.bz2 |
Every file in this commit has a memory leak of some kind or another. I think
all of them are minor and should not effect properly running code. But if I
were you I would give libstocks and the stockticker plugin in Today a wide
berth. That library is atrocious.
-rw-r--r-- | noncore/net/ftplib/ftplib.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/net/ftplib/ftplib.c b/noncore/net/ftplib/ftplib.c index efcd6f0..addf9d2 100644 --- a/noncore/net/ftplib/ftplib.c +++ b/noncore/net/ftplib/ftplib.c | |||
@@ -1163,25 +1163,29 @@ static int FtpXfer(const char *localfile, const char *path, | |||
1163 | ac[1] = 'b'; | 1163 | ac[1] = 'b'; |
1164 | local = fopen(localfile, ac); | 1164 | local = fopen(localfile, ac); |
1165 | if (local == NULL) | 1165 | if (local == NULL) |
1166 | { | 1166 | { |
1167 | strncpy(nControl->response, strerror(errno), | 1167 | strncpy(nControl->response, strerror(errno), |
1168 | sizeof(nControl->response)); | 1168 | sizeof(nControl->response)); |
1169 | return 0; | 1169 | return 0; |
1170 | } | 1170 | } |
1171 | } | 1171 | } |
1172 | if (local == NULL) | 1172 | if (local == NULL) |
1173 | local = (typ == FTPLIB_FILE_WRITE) ? stdin : stdout; | 1173 | local = (typ == FTPLIB_FILE_WRITE) ? stdin : stdout; |
1174 | if (!FtpAccess(path, typ, mode, nControl, &nData)) | 1174 | if (!FtpAccess(path, typ, mode, nControl, &nData)) |
1175 | { | ||
1176 | if (localfile != NULL) | ||
1177 | fclose(local); | ||
1175 | return 0; | 1178 | return 0; |
1179 | } | ||
1176 | dbuf = malloc(FTPLIB_BUFSIZ); | 1180 | dbuf = malloc(FTPLIB_BUFSIZ); |
1177 | if (typ == FTPLIB_FILE_WRITE) | 1181 | if (typ == FTPLIB_FILE_WRITE) |
1178 | { | 1182 | { |
1179 | while ((l = fread(dbuf, 1, FTPLIB_BUFSIZ, local)) > 0) | 1183 | while ((l = fread(dbuf, 1, FTPLIB_BUFSIZ, local)) > 0) |
1180 | if ((c = FtpWrite(dbuf, l, nData)) < l) | 1184 | if ((c = FtpWrite(dbuf, l, nData)) < l) |
1181 | { | 1185 | { |
1182 | printf("short write: passed %d, wrote %d\n", l, c); | 1186 | printf("short write: passed %d, wrote %d\n", l, c); |
1183 | rv = 0; | 1187 | rv = 0; |
1184 | break; | 1188 | break; |
1185 | } | 1189 | } |
1186 | } | 1190 | } |
1187 | else | 1191 | else |