<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Yes, it will result in memory leakage.</div><div><br></div><div>I recommend to use WS_Reserve to allocate your memory within your VMOD.</div><div><br></div><div>Best regards</div><div><br></div><div><br></div><div><div>On 19 May, 2013, at 4:59 PM, flygoast wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><p style="margin: 0px 10px 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; vertical-align: baseline; color: rgb(34, 34, 34);">hi, guys,</p><p style="margin: 0px 10px 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; vertical-align: baseline; color: rgb(34, 34, 34);">I'm newbie in varnish vmod development.</p><p style="margin: 0px 10px 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; vertical-align: baseline; color: rgb(34, 34, 34);">I'am comfusing when I return a char * pointting to a block of memory malloced from heap, Whether resultting in a memory leak?</p><p style="margin: 0px 10px 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; vertical-align: baseline; color: rgb(34, 34, 34);">Such as:</p><p style="margin: 0px 10px 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; vertical-align: baseline; color: rgb(34, 34, 34);">char *</p><p style="margin: 0px 10px 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; vertical-align: baseline; color: rgb(34, 34, 34);">vmod_foo(struct sess *sp, struct vmod_priv *priv)</p><p style="margin: 0px 10px 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; vertical-align: baseline; color: rgb(34, 34, 34);">{</p><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><p style="margin: 0px 10px 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; vertical-align: baseline; color: rgb(34, 34, 34);">return strdup("foo");</p></blockquote><p style="margin: 0px 10px 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; vertical-align: baseline; color: rgb(34, 34, 34);">}</p><p style="margin: 0px 10px 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; vertical-align: baseline; color: rgb(34, 34, 34);">Thank you!</p></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>_______________________________________________<br>varnish-dev mailing list<br><a href="mailto:varnish-dev@varnish-cache.org">varnish-dev@varnish-cache.org</a><br>https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev</blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>----------------------------------</div><div>Best wishes,</div><div>Jammy</div></div><div><br></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br></body></html>