From patchwork Tue Jul 27 12:58:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomer Barletz X-Patchwork-Id: 114524 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6RCwmCC003207 for ; Tue, 27 Jul 2010 12:58:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752754Ab0G0M6j (ORCPT ); Tue, 27 Jul 2010 08:58:39 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:46350 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752377Ab0G0M6i (ORCPT ); Tue, 27 Jul 2010 08:58:38 -0400 Received: by wyf19 with SMTP id 19so3018318wyf.19 for ; Tue, 27 Jul 2010 05:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=EphPzGaFw2TPDLer5vN+RqofiNllHfRkT5GYjRkHmrg=; b=IHusR8JWRvWML6l5cmPnHgPW8bg+M6jATi3+vNwryXM3yOtu2tol6rVYs1tbM1TQdn v13GQTPNbfqizGdZ8kUwMJ+k1ZqSkk+RB8QKt3O82eeKsk3Y3yCPtv5O9f8zFAqIc/CI jvDGHwS7OpxScxbZdhuK0Z0W0brvVsGXHKrfo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=wWaGQxHfhzLxkPGM1rPnkBAvowdVkmmGO+U3dcd9ARvjYqy2G2f1GeFt//GdF7CegR U+4njpYSPVlwTGsiPFrQc1nRzc61wY4bdFflM7R2i9vvjoBIsHJyr8/ukPQwowcciikJ N/elLp3lXaqM4gLcGrNS4871TTrEi++/hghFc= MIME-Version: 1.0 Received: by 10.227.147.72 with SMTP id k8mr8844803wbv.225.1280235517118; Tue, 27 Jul 2010 05:58:37 -0700 (PDT) Received: by 10.227.139.29 with HTTP; Tue, 27 Jul 2010 05:58:37 -0700 (PDT) In-Reply-To: References: Date: Tue, 27 Jul 2010 15:58:37 +0300 Message-ID: Subject: Re: [PATCH] Fix possible memory leak in dvbca.c From: Tomer Barletz To: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 27 Jul 2010 12:58:49 +0000 (UTC) diff -r d3509d6e9499 lib/libdvbapi/dvbca.c --- a/lib/libdvbapi/dvbca.c Sat Aug 08 19:17:21 2009 +0200 +++ b/lib/libdvbapi/dvbca.c Tue Jul 27 15:56:48 2010 +0300 @@ -89,8 +89,10 @@ uint8_t *data, uint16_t data_length) { uint8_t *buf = malloc(data_length + 2); - if (buf == NULL) + if (buf == NULL) { + free(buf); return -1; + } buf[0] = slot; buf[1] = connection_id; @@ -110,8 +112,10 @@ if (buf == NULL) return -1; - if ((size = read(fd, buf, data_length+2)) < 2) + if ((size = read(fd, buf, data_length+2)) < 2) { + free(buf); return -1; + } *slot = buf[0]; *connection_id = buf[1];