diff options
author | Ori Bernstein <ori@eigenstate.org> | 2019-07-14 01:22:52 +0000 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2019-07-14 01:22:52 +0000 |
commit | 34d97453258079f514c3297f88663fc23ff6e080 (patch) | |
tree | ebfdc834ff8c434eff567653bc57126e86a1c2ee /lib | |
parent | cfb284970e8c164d43d814496a5363b92782fb15 (diff) | |
download | mc-34d97453258079f514c3297f88663fc23ff6e080.tar.gz |
Fix memory leak in bigparse. (Thanks, Mike)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/json/test/inputs/n_structure_no_data.json | 0 | ||||
-rw-r--r-- | lib/json/test/inputs/n_structure_whitespace_U+2060_word_joiner.json | 1 | ||||
-rw-r--r-- | lib/json/test/inputs/y_number_negative_zero.json | 1 | ||||
-rw-r--r-- | lib/std/bigint.myr | 2 | ||||
-rw-r--r-- | lib/std/dir+openbsd.myr | 65 | ||||
-rw-r--r-- | lib/std/syswrap-ss+openbsd.myr | 31 | ||||
-rw-r--r-- | lib/sys/ifreq+netbsd.myr | 2 | ||||
-rw-r--r-- | lib/sys/ifreq+openbsd.myr | 2 | ||||
-rw-r--r-- | lib/sys/ifreq+plan9.myr | 2 | ||||
-rw-r--r-- | lib/sys/syserrno+openbsd.myr | 123 | ||||
-rw-r--r-- | lib/thread/ncpu+openbsd.myr | 23 |
11 files changed, 2 insertions, 250 deletions
diff --git a/lib/json/test/inputs/n_structure_no_data.json b/lib/json/test/inputs/n_structure_no_data.json deleted file mode 100644 index e69de29..0000000 --- a/lib/json/test/inputs/n_structure_no_data.json +++ /dev/null diff --git a/lib/json/test/inputs/n_structure_whitespace_U+2060_word_joiner.json b/lib/json/test/inputs/n_structure_whitespace_U+2060_word_joiner.json deleted file mode 100644 index 81156a6..0000000 --- a/lib/json/test/inputs/n_structure_whitespace_U+2060_word_joiner.json +++ /dev/null @@ -1 +0,0 @@ -[]
\ No newline at end of file diff --git a/lib/json/test/inputs/y_number_negative_zero.json b/lib/json/test/inputs/y_number_negative_zero.json deleted file mode 100644 index 37af131..0000000 --- a/lib/json/test/inputs/y_number_negative_zero.json +++ /dev/null @@ -1 +0,0 @@ -[-0]
\ No newline at end of file diff --git a/lib/std/bigint.myr b/lib/std/bigint.myr index 478d9fc..8e078cf 100644 --- a/lib/std/bigint.myr +++ b/lib/std/bigint.myr @@ -284,6 +284,8 @@ const bigparse = {str bigadd(a, v) ;; + bigfree(b) + bigfree(v) -> `Some a } diff --git a/lib/std/dir+openbsd.myr b/lib/std/dir+openbsd.myr deleted file mode 100644 index 274175d..0000000 --- a/lib/std/dir+openbsd.myr +++ /dev/null @@ -1,65 +0,0 @@ -use sys - -use "alloc" -use "die" -use "memops" -use "option" -use "result" -use "slcp" -use "sldup" -use "types" - -pkg std = - type dir = struct - fd : sys.fd - buf : byte[16384] - len : int64 - off : int64 - ;; - - const diropen : (p : byte[:] -> std.result(dir#, byte[:])) - const dirread : (d : dir# -> std.option(byte[:])) - const dirclose : (d : dir# -> void) -;; - -const diropen = {p - var fd - var dir - - fd = sys.open(p, sys.Ordonly | sys.Odir) - if fd < 0 - -> `Err "couldn't open directory" - ;; - dir = zalloc() - dir.fd = fd - -> `Ok dir -} - -const dirread = {d - var len - var dent - var namelen - - if d.off >= d.len - len = sys.getdents(d.fd, d.buf[:]) - if len <= 0 - -> `None - ;; - d.len = len - d.off = 0 - ;; - - dent = (&d.buf[d.off] : sys.dirent#) - namelen = 0 - d.off += (dent.reclen : int64) - while dent.name[namelen] != 0 - namelen++ - ;; - -> `Some sldup(dent.name[:namelen]) -} - -const dirclose = {d - sys.close(d.fd) - free(d) -} - diff --git a/lib/std/syswrap-ss+openbsd.myr b/lib/std/syswrap-ss+openbsd.myr deleted file mode 100644 index 0f4ed65..0000000 --- a/lib/std/syswrap-ss+openbsd.myr +++ /dev/null @@ -1,31 +0,0 @@ -use sys -use "types" -use "errno" -use "cstrconv" -use "slcp" -use "die" - -pkg std = - const nanosleep : (nsecs : uint64 -> errno) - $noret const exit : (status:int -> void) - - pkglocal const bgetcwd : (buf : byte[:] -> errno) -;; - -const exit = {status; sys.exit(status)} - -const bgetcwd = {buf - -> (sys.__getcwd(buf) - 1 : errno) -} - -const nanosleep = {nsecs - var req, rem - var s, ns - - s = (nsecs / 1_000_000_000 : int64) - ns = (nsecs % 1_000_000_000 : int64) - req = [.sec = s, .nsec = ns] - - -> (sys.nanosleep(&req, &rem) : errno) -} - diff --git a/lib/sys/ifreq+netbsd.myr b/lib/sys/ifreq+netbsd.myr deleted file mode 100644 index e7d6400..0000000 --- a/lib/sys/ifreq+netbsd.myr +++ /dev/null @@ -1,2 +0,0 @@ -pkg sys = -;; diff --git a/lib/sys/ifreq+openbsd.myr b/lib/sys/ifreq+openbsd.myr deleted file mode 100644 index e7d6400..0000000 --- a/lib/sys/ifreq+openbsd.myr +++ /dev/null @@ -1,2 +0,0 @@ -pkg sys = -;; diff --git a/lib/sys/ifreq+plan9.myr b/lib/sys/ifreq+plan9.myr deleted file mode 100644 index e7d6400..0000000 --- a/lib/sys/ifreq+plan9.myr +++ /dev/null @@ -1,2 +0,0 @@ -pkg sys = -;; diff --git a/lib/sys/syserrno+openbsd.myr b/lib/sys/syserrno+openbsd.myr deleted file mode 100644 index e48f893..0000000 --- a/lib/sys/syserrno+openbsd.myr +++ /dev/null @@ -1,123 +0,0 @@ -pkg sys = - type errno = int - - const Eperm : errno = -1 /* Operation not permitted */ - const Enoent : errno = -2 /* No such file or directory */ - const Esrch : errno = -3 /* No such process */ - const Eintr : errno = -4 /* Interrupted system call */ - const Eio : errno = -5 /* Input/output error */ - const Enxio : errno = -6 /* Device not configured */ - const E2big : errno = -7 /* Argument list too long */ - const Enoexec : errno = -8 /* Exec format error */ - const Ebadf : errno = -9 /* Bad file descriptor */ - const Echild : errno = -10 /* No child processes */ - const Edeadlk : errno = -11 /* Resource deadlock avoided */ - /* 11 was EAGAIN */ - const Enomem : errno = -12 /* Cannot allocate memory */ - const Eacces : errno = -13 /* Permission denied */ - const Efault : errno = -14 /* Bad address */ - const Enotblk : errno = -15 /* Block device required */ - const Ebusy : errno = -16 /* Device busy */ - const Eexist : errno = -17 /* File exists */ - const Exdev : errno = -18 /* Cross-device link */ - const Enodev : errno = -19 /* Operation not supported by device */ - const Enotdir : errno = -20 /* Not a directory */ - const Eisdir : errno = -21 /* Is a directory */ - const Einval : errno = -22 /* Invalid argument */ - const Enfile : errno = -23 /* Too many open files in system */ - const Emfile : errno = -24 /* Too many open files */ - const Enotty : errno = -25 /* Inappropriate ioctl for device */ - const Etxtbsy : errno = -26 /* Text file busy */ - const Efbig : errno = -27 /* File too large */ - const Enospc : errno = -28 /* No space left on device */ - const Espipe : errno = -29 /* Illegal seek */ - const Erofs : errno = -30 /* Read-only filesystem */ - const Emlink : errno = -31 /* Too many links */ - const Epipe : errno = -32 /* Broken pipe */ - - /* math software */ - const Edom : errno = -33 /* Numerical argument out of domain */ - const Erange : errno = -34 /* Result too large */ - - /* non-blocking and interrupt i/o */ - const Eagain : errno = -35 /* Resource temporarily unavailable */ - const Einprogress : errno = -36 /* Operation now in progress */ - const Ealready : errno = -37 /* Operation already in progress */ - - /* ipc/network software -- argument errors */ - const Enotsock : errno = -38 /* Socket operation on non-socket */ - const Edestaddrreq : errno = -39 /* Destination address required */ - const Emsgsize : errno = -40 /* Message too long */ - const Eprototype : errno = -41 /* Protocol wrong type for socket */ - const Enoprotoopt : errno = -42 /* Protocol not available */ - const Eprotonosupport : errno = -43 /* Protocol not supported */ - const Esocktnosupport : errno = -44 /* Socket type not supported */ - const Eopnotsupp : errno = -45 /* Operation not supported */ - const Epfnosupport : errno = -46 /* Protocol family not supported */ - const Eafnosupport : errno = -47 /* Address family not supported by protocol family */ - const Eaddrinuse : errno = -48 /* Address already in use */ - const Eaddrnotavail : errno = -49 /* Can't assign requested address */ - - /* ipc/network software -- operational errors */ - const Enetdown : errno = -50 /* Network is down */ - const Enetunreach : errno = -51 /* Network is unreachable */ - const Enetreset : errno = -52 /* Network dropped connection on reset */ - const Econnaborted : errno = -53 /* Software caused connection abort */ - const Econnreset : errno = -54 /* Connection reset by peer */ - const Enobufs : errno = -55 /* No buffer space available */ - const Eisconn : errno = -56 /* Socket is already connected */ - const Enotconn : errno = -57 /* Socket is not connected */ - const Eshutdown : errno = -58 /* Can't send after socket shutdown */ - const Etoomanyrefs : errno = -59 /* Too many references: can't splice */ - const Etimedout : errno = -60 /* Operation timed out */ - const Econnrefused : errno = -61 /* Connection refused */ - - const Eloop : errno = -62 /* Too many levels of symbolic links */ - const Enametoolong : errno = -63 /* File name too long */ - - /* should be rearranged */ - const Ehostdown : errno = -64 /* Host is down */ - const Ehostunreach : errno = -65 /* No route to host */ - const Enotempty : errno = -66 /* Directory not empty */ - - /* quotas & mush */ - const Eproclim : errno = -67 /* Too many processes */ - const Eusers : errno = -68 /* Too many users */ - const Edquot : errno = -69 /* Disc quota exceeded */ - - /* Network File System */ - const Estale : errno = -70 /* Stale NFS file handle */ - const Eremote : errno = -71 /* Too many levels of remote in path */ - const Ebadrpc : errno = -72 /* RPC struct is bad */ - const Erpcmismatch : errno = -73 /* RPC version wrong */ - const Eprogunavail : errno = -74 /* RPC prog. not avail */ - const Eprogmismatch : errno = -75 /* Program version wrong */ - const Eprocunavail : errno = -76 /* Bad procedure for program */ - - const Enolck : errno = -77 /* No locks available */ - const Enosys : errno = -78 /* Function not implemented */ - - const Eftype : errno = -79 /* Inappropriate file type or format */ - const Eauth : errno = -80 /* Authentication error */ - const Eneedauth : errno = -81 /* Need authenticator */ - const Eidrm : errno = -82 /* Identifier removed */ - const Enomsg : errno = -83 /* No message of desired type */ - const Eoverflow : errno = -84 /* Value too large to be stored in data type */ - const Ecanceled : errno = -85 /* Operation canceled */ - const Eilseq : errno = -86 /* Illegal byte sequence */ - const Enoattr : errno = -87 /* Attribute not found */ - - const Edoofus : errno = -88 /* Programming error */ - - const Ebadmsg : errno = -89 /* Bad message */ - const Emultihop : errno = -90 /* Multihop attempted */ - const Enolink : errno = -91 /* Link has been severed */ - const Eproto : errno = -92 /* Protocol error */ - - const Enotcapable : errno = -93 /* Capabilities insufficient */ - const Ecapmode : errno = -94 /* Not permitted in capability mode */ - const Enotrecoverable : errno = -95 /* State not recoverable */ - const Eownerdead : errno = -96 /* Previous owner died */ - - const Elast : errno = -96 /* Must be equal largest errno */ -;; diff --git a/lib/thread/ncpu+openbsd.myr b/lib/thread/ncpu+openbsd.myr deleted file mode 100644 index 1aa3dc1..0000000 --- a/lib/thread/ncpu+openbsd.myr +++ /dev/null @@ -1,23 +0,0 @@ -use std -use sys - -pkg thread = - const ncpu : (-> int) -;; - -const ncpu = { - var mib : int[2] - var ncpu : int - var ncpusz - var res - - mib[0] = 6 /* CTL_HW */ - mib[1] = 3 /* HW_NCPU */ - ncpusz = sizeof(int) - - res = sys.sysctl(mib[:], (&ncpu : void#), &ncpusz, (0 : void#), (0 : sys.size#)) - if res < 0 || ncpu <= 0 - -> 1 - ;; - -> ncpu -} |