ruby-ripmime 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/ruby-ripmime.c +24 -0
- metadata +3 -3
data/ext/ruby-ripmime.c
CHANGED
@@ -10,6 +10,17 @@ static VALUE ruby_ripmime_decode(VALUE self, VALUE mailpack, VALUE outputdir) {
|
|
10
10
|
VALUE errmsg;
|
11
11
|
char buf[BUFSIZ];
|
12
12
|
|
13
|
+
Check_Type(mailpack, T_STRING);
|
14
|
+
Check_Type(outputdir, T_STRING);
|
15
|
+
|
16
|
+
if (RSTRING_LEN(mailpack) < 1) {
|
17
|
+
rb_raise(rb_eArgError, "mailpack is empty");
|
18
|
+
}
|
19
|
+
|
20
|
+
if (RSTRING_LEN(outputdir) < 1) {
|
21
|
+
rb_raise(rb_eArgError, "outputdir is empty");
|
22
|
+
}
|
23
|
+
|
13
24
|
fp_err = tmpfile();
|
14
25
|
|
15
26
|
if (fp_err == NULL) {
|
@@ -34,8 +45,21 @@ static VALUE ruby_ripmime_decode(VALUE self, VALUE mailpack, VALUE outputdir) {
|
|
34
45
|
|
35
46
|
RIPMIME_init(&rm);
|
36
47
|
|
48
|
+
// XXX: for strdup memory leak (ripMIME 1.4.0.10)
|
49
|
+
rm.outputdir = NULL;
|
50
|
+
rm.mailpack = NULL;
|
51
|
+
|
37
52
|
ret = RIPMIME_decode(&rm, StringValuePtr(mailpack), StringValuePtr(outputdir));
|
38
53
|
|
54
|
+
// XXX: for strdup memory leak (ripMIME 1.4.0.10)
|
55
|
+
if (rm.outputdir) {
|
56
|
+
free(rm.outputdir);
|
57
|
+
}
|
58
|
+
|
59
|
+
if (rm.mailpack) {
|
60
|
+
free(rm.mailpack);
|
61
|
+
}
|
62
|
+
|
39
63
|
if (dup2(fd_stdout, fileno(stdout)) == -1) {
|
40
64
|
rb_raise(rb_eRuntimeError, strerror(errno));
|
41
65
|
}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-ripmime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- winebarrel
|